Commit 2a878253b8f7bbae107cef2bcf5f10642b93bf4d

Authored by Mumfrey
1 parent 48da29aa

initial commit for 1.8

+ All GL moved to GLStateManager
 + GL Convenience class added
 + Added EnumerationObserver
 + CallbackInjectionTransformer is deprecated
 + PacketTransformer is removed
 + Added JSON Event Transformer definitions
 + Event Transformers now support capturing local vars
Showing 86 changed files with 3866 additions and 1310 deletions
.classpath
... ... @@ -7,17 +7,18 @@
7 7 <classpathentry combineaccessrules="false" exported="true" kind="src" path="/Client"/>
8 8 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
9 9 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"/>
10   - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar"/>
  10 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/google/guava/guava/17.0/guava-17.0.jar"/>
11 11 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
12 12 <classpathentry exported="true" kind="lib" path="lib/launchwrapper-1.11.jar" sourcepath="externals/launchwrapper/src"/>
13   - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar"/>
14   - <classpathentry kind="lib" path="/Client/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar"/>
15   - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar"/>
  13 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar"/>
  14 + <classpathentry kind="lib" path="/Client/jars/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar"/>
  15 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/io/netty/netty-all/4.0.15.Final/netty-all-4.0.15.Final.jar"/>
16 16 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar"/>
17 17 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar"/>
18 18 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar"/>
19   - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/mojang/authlib/1.5.16/authlib-1.5.16.jar"/>
  19 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/mojang/authlib/1.5.17/authlib-1.5.17.jar"/>
20 20 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar"/>
21 21 <classpathentry exported="true" kind="lib" path="lib/asm-debug-all-5.0.3.jar"/>
  22 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar"/>
22 23 <classpathentry kind="output" path="bin"/>
23 24 </classpath>
... ...
ant/build_liteloader.xml
... ... @@ -4,8 +4,8 @@
4 4 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="tasks/ant-contrib.jar" />
5 5  
6 6 <!-- Versions !!IMPORTANT -->
7   - <property name="version" value="1.7.10_04" />
8   - <property name="mcversion" value="1.7.10" />
  7 + <property name="version" value="1.8.0_00" />
  8 + <property name="mcversion" value="1.8.00" />
9 9 <property name="author" value="Mumfrey" />
10 10  
11 11 <!-- Project definitions and dependencies -->
... ...
debug/obfuscation.properties
1 1 field_71424_I=mcProfiler
2 2 field_78729_o=entityRenderMap field_110546_b=reloadListeners
3   -func_148833_a=processPacket func_71411_J=runGameLoop func_71407_l=runTick func_78480_b=updateCameraAndRender func_78471_a=renderWorld func_73830_a=renderGameOverlay func_76320_a=startSection func_76319_b=endSection func_76318_c=endStartSection
4   -func_72368_a=respawnPlayer func_72355_a=initializeConnectionToPlayer func_72377_c=playerLoggedIn func_72367_e=playerLoggedOut
  3 +field_147393_d=networkManager
  4 +field_82596_a=registryObjects field_148759_a=underlyingIntegerMap #field_148749_a=
  5 +#field_148748_b= field_147559_m=mapSpecialRenderers
  6 +field_145855_i=nameToClassMap
  7 +field_145853_j=classToNameMap func_148833_a=processPacket func_71411_J=runGameLoop func_71407_l=runTick func_78480_b=updateCameraAndRender
  8 +func_78471_a=renderWorld func_175180_a=renderGameOverlay func_76320_a=startSection
  9 +func_76319_b=endSection
  10 +func_76318_c=endStartSection
  11 +func_148545_a=createPlayerForUser
  12 +func_72368_a=recreatePlayerEntity
  13 +func_72355_a=initializeConnectionToPlayer
  14 +func_72377_c=playerLoggedIn
  15 +func_72367_e=playerLoggedOut
5 16 func_71384_a=startGame
6 17 func_71197_b=startServer
7 18 func_71256_s=startServerThread
8 19 func_71165_d=sendChatMessage
9   -func_148545_a=createPlayerForUser
10 20 func_147119_ah=updateFramebufferSize
11   -field_82596_a=registryObjects
12   -field_148759_a=underlyingIntegerMap
13   -#field_148749_a=
14   -#field_148748_b=
15   -field_147559_m=mapSpecialRenderers
16   -field_145855_i=nameToClassMap
17   -field_145853_j=classToNameMap
18 21 func_147615_c=framebufferRender
  22 +func_178038_a=framebufferRenderExt
19 23 func_147612_c=bindFramebufferTexture
20   -func_146230_a=drawChat
21 24 \ No newline at end of file
  25 +func_146230_a=drawChat
  26 +func_179086_m=clear
  27 +func_175068_a=renderWorldPass
  28 +func_148256_e=getProfile
22 29 \ No newline at end of file
... ...
java/client/com/mumfrey/liteloader/FrameBufferListener.java
... ... @@ -15,7 +15,7 @@ public interface FrameBufferListener extends LiteMod
15 15 public abstract void preRenderFBO(Framebuffer fbo);
16 16  
17 17 /**
18   - * Called immediately before the FBO is rendered to the screen, after the appropriate GL modes and matrix transforms
  18 + * Called immediately before the FBO is rendered to the screen, after the appropriate IGL modes and matrix transforms
19 19 * have been set but before the FBO is actually rendered into the main output buffer.
20 20 *
21 21 * @param fbo FBO instance
... ...
java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java
1 1 package com.mumfrey.liteloader.client;
2 2  
  3 +import java.util.UUID;
  4 +
3 5 import net.minecraft.client.Minecraft;
4   -import net.minecraft.client.entity.EntityClientPlayerMP;
  6 +import net.minecraft.client.entity.EntityPlayerSP;
5 7 import net.minecraft.client.gui.GuiIngame;
6 8 import net.minecraft.client.renderer.EntityRenderer;
7 9 import net.minecraft.client.renderer.OpenGlHelper;
8 10 import net.minecraft.client.shader.Framebuffer;
  11 +import net.minecraft.entity.player.EntityPlayer;
9 12 import net.minecraft.entity.player.EntityPlayerMP;
10 13 import net.minecraft.network.NetworkManager;
11 14 import net.minecraft.server.integrated.IntegratedServer;
12 15 import net.minecraft.server.management.ServerConfigurationManager;
  16 +import net.minecraft.util.Session;
13 17 import net.minecraft.world.WorldSettings;
14 18  
15 19 import com.mojang.authlib.GameProfile;
... ... @@ -30,7 +34,7 @@ public class CallbackProxyClient
30 34 */
31 35 private static boolean clock = false;
32 36  
33   - private static ClientEvents events;
  37 + private static EventsClient events;
34 38  
35 39 private static boolean fboEnabled;
36 40  
... ... @@ -38,7 +42,7 @@ public class CallbackProxyClient
38 42  
39 43 public static void onStartupComplete(EventInfo<Minecraft> e)
40 44 {
41   - CallbackProxyClient.events = ClientEvents.getInstance();
  45 + CallbackProxyClient.events = EventsClient.getInstance();
42 46  
43 47 if (CallbackProxyClient.events == null)
44 48 {
... ... @@ -74,12 +78,12 @@ public class CallbackProxyClient
74 78 CallbackProxyClient.events.preRenderGUI(partialTicks);
75 79 }
76 80  
77   - public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
  81 + public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
78 82 {
79 83 CallbackProxyClient.events.onSetupCameraTransform(partialTicks, timeSlice);
80 84 }
81 85  
82   - public static void postRenderEntities(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
  86 + public static void postRenderEntities(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
83 87 {
84 88 CallbackProxyClient.events.postRenderEntities(partialTicks, timeSlice);
85 89 }
... ... @@ -94,14 +98,14 @@ public class CallbackProxyClient
94 98 CallbackProxyClient.events.onRenderHUD(partialTicks);
95 99 }
96 100  
97   - public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks, boolean guiActive, int mouseX, int mouseY)
  101 + public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks)
98 102 {
99   - CallbackProxyClient.events.onRenderChat(e.getSource().getChatGUI(), partialTicks, guiActive, mouseX, mouseY);
  103 + CallbackProxyClient.events.onRenderChat(e.getSource().getChatGUI(), partialTicks);
100 104 }
101 105  
102   - public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks, boolean guiActive, int mouseX, int mouseY)
  106 + public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks)
103 107 {
104   - CallbackProxyClient.events.postRenderChat(e.getSource().getChatGUI(), partialTicks, guiActive, mouseX, mouseY);
  108 + CallbackProxyClient.events.postRenderChat(e.getSource().getChatGUI(), partialTicks);
105 109 }
106 110  
107 111 public static void postRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
... ... @@ -139,7 +143,7 @@ public class CallbackProxyClient
139 143 CallbackProxyClient.events.onRespawnPlayer(e.getSource(), e.getReturnValue(), oldPlayer, dimension, won);
140 144 }
141 145  
142   - public static void onOutboundChat(EventInfo<EntityClientPlayerMP> e, String message)
  146 + public static void onOutboundChat(EventInfo<EntityPlayerSP> e, String message)
143 147 {
144 148 CallbackProxyClient.events.onSendChatMessage(e, message);
145 149 }
... ... @@ -173,7 +177,7 @@ public class CallbackProxyClient
173 177 }
174 178 }
175 179  
176   - public static void renderFBO(EventInfo<Framebuffer> e, int width, int height)
  180 + public static void renderFBO(EventInfo<Framebuffer> e, int width, int height, boolean flag)
177 181 {
178 182 if (CallbackProxyClient.events == null) return;
179 183 if (CallbackProxyClient.renderingFBO)
... ... @@ -188,4 +192,15 @@ public class CallbackProxyClient
188 192 {
189 193 CallbackProxyClient.events.onRenderWorld(partialTicks, timeSlice);
190 194 }
  195 +
  196 + /**
  197 + * Compatiblbe behaviour with FML, this method is called to generate a consistent offline UUID between client and server
  198 + * for a given username.
  199 + */
  200 + public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e)
  201 + {
  202 + Session session = e.getSource();
  203 + UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, session.getUsername()));
  204 + e.setReturnValue(new GameProfile(uuid, session.getUsername()));
  205 + }
191 206 }
... ...
java/client/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java
... ... @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
4 4 import net.minecraft.client.network.NetHandlerLoginClient;
5 5 import net.minecraft.network.INetHandler;
6 6 import net.minecraft.network.NetworkManager;
  7 +import net.minecraft.network.PacketBuffer;
7 8 import net.minecraft.network.login.INetHandlerLoginClient;
8 9 import net.minecraft.network.login.server.S02PacketLoginSuccess;
9 10 import net.minecraft.network.play.INetHandlerPlayClient;
... ... @@ -48,10 +49,10 @@ public class ClientPluginChannelsClient extends ClientPluginChannels
48 49 @Override
49 50 public void onPluginChannelMessage(S3FPacketCustomPayload customPayload)
50 51 {
51   - if (customPayload != null && customPayload.func_149169_c() != null) // getChannel
  52 + if (customPayload != null && customPayload.getChannelName() != null)
52 53 {
53   - String channel = customPayload.func_149169_c(); // getChannel
54   - byte[] data = customPayload.func_149168_d(); // getData
  54 + String channel = customPayload.getChannelName();
  55 + PacketBuffer data = customPayload.getBufferData();
55 56  
56 57 this.onPluginChannelMessage(channel, data);
57 58 }
... ... @@ -62,12 +63,12 @@ public class ClientPluginChannelsClient extends ClientPluginChannels
62 63 * @param registrationData
63 64 */
64 65 @Override
65   - protected void sendRegistrationData(INetHandler netHandler, byte[] registrationData)
  66 + protected void sendRegistrationData(INetHandler netHandler, PacketBuffer registrationData)
66 67 {
67 68 if (netHandler instanceof INetHandlerLoginClient)
68 69 {
69 70 NetworkManager networkManager = PrivateFields.netManager.get(((NetHandlerLoginClient)netHandler));
70   - networkManager.scheduleOutboundPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
  71 + networkManager.sendPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
71 72 }
72 73 else if (netHandler instanceof INetHandlerPlayClient)
73 74 {
... ... @@ -82,7 +83,7 @@ public class ClientPluginChannelsClient extends ClientPluginChannels
82 83 * @param data
83 84 */
84 85 @Override
85   - protected boolean send(String channel, byte[] data, ChannelPolicy policy)
  86 + protected boolean send(String channel, PacketBuffer data, ChannelPolicy policy)
86 87 {
87 88 if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel))
88 89 throw new RuntimeException("Invalid channel name specified");
... ...
java/client/com/mumfrey/liteloader/client/ClientEvents.java renamed to java/client/com/mumfrey/liteloader/client/EventsClient.java
1 1 package com.mumfrey.liteloader.client;
2 2  
3 3 import net.minecraft.client.Minecraft;
4   -import net.minecraft.client.entity.EntityClientPlayerMP;
  4 +import net.minecraft.client.entity.EntityPlayerSP;
5 5 import net.minecraft.client.gui.GuiNewChat;
6 6 import net.minecraft.client.gui.ScaledResolution;
7 7 import net.minecraft.client.shader.Framebuffer;
  8 +import net.minecraft.entity.Entity;
8 9 import net.minecraft.network.play.client.C01PacketChatMessage;
9 10 import net.minecraft.server.integrated.IntegratedServer;
10 11 import net.minecraft.util.Timer;
11 12  
12 13 import org.lwjgl.input.Mouse;
13 14  
14   -import com.mumfrey.liteloader.*;
  15 +import com.mumfrey.liteloader.ChatRenderListener;
  16 +import com.mumfrey.liteloader.FrameBufferListener;
  17 +import com.mumfrey.liteloader.GameLoopListener;
  18 +import com.mumfrey.liteloader.HUDRenderListener;
  19 +import com.mumfrey.liteloader.InitCompleteListener;
  20 +import com.mumfrey.liteloader.OutboundChatFilter;
  21 +import com.mumfrey.liteloader.OutboundChatListener;
  22 +import com.mumfrey.liteloader.PostRenderListener;
  23 +import com.mumfrey.liteloader.RenderListener;
  24 +import com.mumfrey.liteloader.Tickable;
  25 +import com.mumfrey.liteloader.ViewportListener;
15 26 import com.mumfrey.liteloader.client.overlays.IMinecraft;
16 27 import com.mumfrey.liteloader.common.LoadingProgress;
17 28 import com.mumfrey.liteloader.core.Events;
... ... @@ -24,9 +35,9 @@ import com.mumfrey.liteloader.launch.LoaderProperties;
24 35 import com.mumfrey.liteloader.transformers.event.EventInfo;
25 36 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
26 37  
27   -public class ClientEvents extends Events<Minecraft, IntegratedServer>
  38 +public class EventsClient extends Events<Minecraft, IntegratedServer>
28 39 {
29   - private static ClientEvents instance;
  40 + private static EventsClient instance;
30 41  
31 42 /**
32 43 * Reference to the game
... ... @@ -82,18 +93,18 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
82 93 private FastIterableDeque<OutboundChatFilter> outboundChatFilters = new HandlerList<OutboundChatFilter>(OutboundChatFilter.class, ReturnLogicOp.AND);
83 94  
84 95 @SuppressWarnings("cast")
85   - public ClientEvents(LiteLoader loader, GameEngineClient engine, LoaderProperties properties)
  96 + public EventsClient(LiteLoader loader, GameEngineClient engine, LoaderProperties properties)
86 97 {
87 98 super(loader, engine, properties);
88 99  
89   - ClientEvents.instance = this;
  100 + EventsClient.instance = this;
90 101  
91 102 this.engineClient = (GameEngineClient)engine;
92 103 }
93 104  
94   - static ClientEvents getInstance()
  105 + static EventsClient getInstance()
95 106 {
96   - return ClientEvents.instance;
  107 + return EventsClient.instance;
97 108 }
98 109  
99 110 /* (non-Javadoc)
... ... @@ -330,20 +341,20 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
330 341 * Called immediately before the chat log is rendered
331 342 *
332 343 * @param chatGui
333   - * @param mouseY
334   - * @param mouseX
335   - * @param guiActive
336 344 * @param partialTicks
337 345 */
338   - void onRenderChat(GuiNewChat chatGui, float partialTicks, boolean guiActive, int mouseX, int mouseY)
  346 + void onRenderChat(GuiNewChat chatGui, float partialTicks)
339 347 {
340 348 this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui);
341 349 }
342 350  
343 351 /**
344 352 * Called immediately after the chat log is rendered
  353 + *
  354 + * @param chatGui
  355 + * @param partialTicks
345 356 */
346   - void postRenderChat(GuiNewChat chatGui, float partialTicks, boolean guiActive, int mouseX, int mouseY)
  357 + void postRenderChat(GuiNewChat chatGui, float partialTicks)
347 358 {
348 359 GuiNewChat chat = this.engineClient.getChatGUI();
349 360 this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat);
... ... @@ -401,7 +412,8 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
401 412 Minecraft minecraft = this.engine.getClient();
402 413  
403 414 // Flag indicates whether we are in game at the moment
404   - boolean inGame = minecraft.renderViewEntity != null && minecraft.renderViewEntity.worldObj != null;
  415 + Entity renderViewEntity = minecraft.getRenderViewEntity(); // TODO OBF MCPTEST func_175606_aa - getRenderViewEntity
  416 + boolean inGame = renderViewEntity != null && renderViewEntity.worldObj != null;
405 417  
406 418 this.profiler.startSection("loader");
407 419 super.onTick(clock, partialTicks, inGame);
... ... @@ -445,7 +457,7 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
445 457 /**
446 458 * @param message
447 459 */
448   - void onSendChatMessage(EventInfo<EntityClientPlayerMP> e, String message)
  460 + void onSendChatMessage(EventInfo<EntityPlayerSP> e, String message)
449 461 {
450 462 if (!this.outboundChatFilters.all().onSendChatMessage(message))
451 463 {
... ...
java/client/com/mumfrey/liteloader/client/api/LiteLoaderBrandingProvider.java
... ... @@ -3,10 +3,10 @@ package com.mumfrey.liteloader.client.api;
3 3 import java.net.URI;
4 4  
5 5 import net.minecraft.client.resources.I18n;
6   -import net.minecraft.util.IIcon;
7 6 import net.minecraft.util.ResourceLocation;
8 7  
9 8 import com.mumfrey.liteloader.api.BrandingProvider;
  9 +import com.mumfrey.liteloader.client.util.render.Icon;
10 10 import com.mumfrey.liteloader.client.util.render.IconAbsolute;
11 11 import com.mumfrey.liteloader.core.LiteLoader;
12 12  
... ... @@ -84,7 +84,7 @@ public class LiteLoaderBrandingProvider implements BrandingProvider
84 84 * @see com.mumfrey.liteloader.api.BrandingProvider#getLogoCoords()
85 85 */
86 86 @Override
87   - public IIcon getLogoCoords()
  87 + public Icon getLogoCoords()
88 88 {
89 89 return LiteLoaderBrandingProvider.LOGO_COORDS;
90 90 }
... ... @@ -102,7 +102,7 @@ public class LiteLoaderBrandingProvider implements BrandingProvider
102 102 * @see com.mumfrey.liteloader.api.BrandingProvider#getIconCoords()
103 103 */
104 104 @Override
105   - public IIcon getIconCoords()
  105 + public Icon getIconCoords()
106 106 {
107 107 return LiteLoaderBrandingProvider.ICON_COORDS;
108 108 }
... ... @@ -129,7 +129,7 @@ public class LiteLoaderBrandingProvider implements BrandingProvider
129 129 * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarCoords()
130 130 */
131 131 @Override
132   - public IIcon getTwitterAvatarCoords()
  132 + public Icon getTwitterAvatarCoords()
133 133 {
134 134 return LiteLoaderBrandingProvider.TWITTER_AVATAR_COORDS;
135 135 }
... ...
java/client/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java
... ... @@ -15,6 +15,7 @@ import com.mumfrey.liteloader.core.LiteLoader;
15 15 import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
16 16 import com.mumfrey.liteloader.interfaces.ObjectFactory;
17 17 import com.mumfrey.liteloader.messaging.MessageBus;
  18 +import com.mumfrey.liteloader.transformers.event.json.ModEvents;
18 19  
19 20 /**
20 21 * Client side of the core API
... ... @@ -34,11 +35,10 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
34 35 private static final String[] requiredDownstreamTransformers = {
35 36 LiteLoaderCoreAPI.PKG_LITELOADER_COMMON + ".transformers.LiteLoaderPacketTransformer",
36 37 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",
37   - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftOverlayTransformer"
  38 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftOverlayTransformer",
  39 + LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.json.ModEventInjectionTransformer"
38 40 };
39 41  
40   - private static final String[] defaultPacketTransformers = {};
41   -
42 42 private ObjectFactory<Minecraft, IntegratedServer> objectFactory;
43 43  
44 44 /* (non-Javadoc)
... ... @@ -60,15 +60,6 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
60 60 }
61 61  
62 62 /* (non-Javadoc)
63   - * @see com.mumfrey.liteloader.api.LiteAPI#getPacketTransformers()
64   - */
65   - @Override
66   - public String[] getPacketTransformers()
67   - {
68   - return LiteLoaderCoreAPIClient.defaultPacketTransformers;
69   - }
70   -
71   - /* (non-Javadoc)
72 63 * @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders()
73 64 */
74 65 @Override
... ... @@ -114,6 +105,18 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
114 105 }
115 106  
116 107 /* (non-Javadoc)
  108 + * @see com.mumfrey.liteloader.api.LiteAPI#getPreInitObservers()
  109 + */
  110 + @Override
  111 + public List<Observer> getPreInitObservers()
  112 + {
  113 + return ImmutableList.<Observer>of
  114 + (
  115 + new ModEvents()
  116 + );
  117 + }
  118 +
  119 + /* (non-Javadoc)
117 120 * @see com.mumfrey.liteloader.api.LiteAPI#getObservers()
118 121 */
119 122 @Override
... ...
java/client/com/mumfrey/liteloader/client/api/ObjectFactoryClient.java
... ... @@ -4,7 +4,7 @@ import net.minecraft.client.Minecraft;
4 4 import net.minecraft.client.gui.GuiScreen;
5 5 import net.minecraft.server.integrated.IntegratedServer;
6 6  
7   -import com.mumfrey.liteloader.client.ClientEvents;
  7 +import com.mumfrey.liteloader.client.EventsClient;
8 8 import com.mumfrey.liteloader.client.ClientPluginChannelsClient;
9 9 import com.mumfrey.liteloader.client.GameEngineClient;
10 10 import com.mumfrey.liteloader.client.LiteLoaderPanelManager;
... ... @@ -34,7 +34,7 @@ class ObjectFactoryClient implements ObjectFactory&lt;Minecraft, IntegratedServer&gt;
34 34  
35 35 private LoaderProperties properties;
36 36  
37   - private ClientEvents clientEvents;
  37 + private EventsClient clientEvents;
38 38  
39 39 private PacketEventsClient clientPacketEvents;
40 40  
... ... @@ -57,7 +57,7 @@ class ObjectFactoryClient implements ObjectFactory&lt;Minecraft, IntegratedServer&gt;
57 57 {
58 58 if (this.clientEvents == null)
59 59 {
60   - this.clientEvents = new ClientEvents(LiteLoader.getInstance(), (GameEngineClient)this.getGameEngine(), this.properties);
  60 + this.clientEvents = new EventsClient(LiteLoader.getInstance(), (GameEngineClient)this.getGameEngine(), this.properties);
61 61 }
62 62  
63 63 return this.clientEvents;
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiCheckbox.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
3   -import static org.lwjgl.opengl.GL11.*;
4   -
5   -import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
6   -
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
7 4 import net.minecraft.client.Minecraft;
8 5 import net.minecraft.client.gui.GuiButton;
9 6  
  7 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  8 +
10 9 /**
11 10 * Super-simple implementation of a checkbox control
12 11 *
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiLiteLoaderPanel.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
3   -import static org.lwjgl.opengl.GL11.*;
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
4 4  
  5 +import java.io.IOException;
5 6 import java.util.ArrayList;
6 7 import java.util.List;
7 8  
... ... @@ -11,21 +12,22 @@ import net.minecraft.client.gui.GuiButton;
11 12 import net.minecraft.client.gui.GuiMainMenu;
12 13 import net.minecraft.client.gui.GuiScreen;
13 14 import net.minecraft.client.renderer.Tessellator;
  15 +import net.minecraft.client.renderer.WorldRenderer;
14 16 import net.minecraft.client.resources.I18n;
15   -import net.minecraft.util.IIcon;
16 17 import net.minecraft.util.ResourceLocation;
17 18  
18 19 import org.lwjgl.input.Keyboard;
19 20 import org.lwjgl.input.Mouse;
20 21  
21 22 import com.mumfrey.liteloader.LiteMod;
22   -import com.mumfrey.liteloader.api.LiteAPI;
23 23 import com.mumfrey.liteloader.api.BrandingProvider;
  24 +import com.mumfrey.liteloader.api.LiteAPI;
24 25 import com.mumfrey.liteloader.api.ModInfoDecorator;
25 26 import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  27 +import com.mumfrey.liteloader.client.util.render.Icon;
26 28 import com.mumfrey.liteloader.core.LiteLoader;
27   -import com.mumfrey.liteloader.core.LiteLoaderVersion;
28 29 import com.mumfrey.liteloader.core.LiteLoaderMods;
  30 +import com.mumfrey.liteloader.core.LiteLoaderVersion;
29 31 import com.mumfrey.liteloader.core.ModInfo;
30 32 import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
31 33 import com.mumfrey.liteloader.launch.LoaderEnvironment;
... ... @@ -109,10 +111,10 @@ public class GuiLiteLoaderPanel extends GuiScreen
109 111 private int brandColour = LiteLoaderBrandingProvider.BRANDING_COLOUR;
110 112  
111 113 private ResourceLocation logoResource = LiteLoaderBrandingProvider.ABOUT_TEXTURE;
112   - private IIcon logoCoords = LiteLoaderBrandingProvider.LOGO_COORDS;
  114 + private Icon logoCoords = LiteLoaderBrandingProvider.LOGO_COORDS;
113 115  
114 116 private ResourceLocation iconResource = LiteLoaderBrandingProvider.ABOUT_TEXTURE;
115   - private IIcon iconCoords = LiteLoaderBrandingProvider.ICON_COORDS;
  117 + private Icon iconCoords = LiteLoaderBrandingProvider.ICON_COORDS;
116 118  
117 119 private List<ModInfoDecorator> modInfoDecorators = new ArrayList<ModInfoDecorator>();
118 120  
... ... @@ -174,7 +176,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
174 176 }
175 177  
176 178 ResourceLocation logoResource = brandingProvider.getLogoResource();
177   - IIcon logoCoords = brandingProvider.getLogoCoords();
  179 + Icon logoCoords = brandingProvider.getLogoCoords();
178 180 if (logoResource != null && logoCoords != null && brandingProvider.getPriority() > logoProviderPriority)
179 181 {
180 182 logoProvider = api;
... ... @@ -184,7 +186,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
184 186 }
185 187  
186 188 ResourceLocation iconResource = brandingProvider.getIconResource();
187   - IIcon iconCoords = brandingProvider.getIconCoords();
  189 + Icon iconCoords = brandingProvider.getIconCoords();
188 190 if (iconResource != null && iconCoords != null && brandingProvider.getPriority() > iconProviderPriority)
189 191 {
190 192 iconProviderPriority = brandingProvider.getPriority();
... ... @@ -551,7 +553,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
551 553 * @see net.minecraft.client.gui.GuiScreen#mouseClicked(int, int, int)
552 554 */
553 555 @Override
554   - protected void mouseClicked(int mouseX, int mouseY, int button)
  556 + protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException
555 557 {
556 558 this.currentPanel.mousePressed(mouseX - LEFT_EDGE, mouseY, button);
557 559  
... ... @@ -587,7 +589,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
587 589 * @see net.minecraft.client.gui.GuiScreen#handleMouseInput()
588 590 */
589 591 @Override
590   - public void handleMouseInput()
  592 + public void handleMouseInput() throws IOException
591 593 {
592 594 int mouseWheelDelta = Mouse.getEventDWheel();
593 595 if (mouseWheelDelta != 0)
... ... @@ -699,7 +701,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
699 701 mouseX = Math.max(0, Math.min(screenWidth - 4, mouseX - 4));
700 702 mouseY = Math.max(0, Math.min(screenHeight - 16, mouseY));
701 703 drawRect(mouseX - textSize - 2, mouseY, mouseX + 2, mouseY + 12, backgroundColour);
702   - fontRenderer.drawStringWithShadow(tooltipText, mouseX - textSize, mouseY + 2, colour);
  704 + fontRenderer.drawStringWithShadow(tooltipText, mouseX - textSize, mouseY + 2, colour); // TODO OBF MCPTEST drawStringWithShadow - func_175063_a
703 705 }
704 706  
705 707  
... ... @@ -733,21 +735,22 @@ public class GuiLiteLoaderPanel extends GuiScreen
733 735 */
734 736 static void glDrawTexturedRect(int x, int y, int width, int height, float u, float v, float u2, float v2, float alpha)
735 737 {
736   - glDisable(GL_LIGHTING);
737   - glEnable(GL_BLEND);
  738 + glDisableLighting();
  739 + glEnableBlend();
738 740 glAlphaFunc(GL_GREATER, 0.0F);
739   - glEnable(GL_TEXTURE_2D);
  741 + glEnableTexture2D();
740 742 glColor4f(1.0F, 1.0F, 1.0F, alpha);
741 743  
742   - Tessellator tessellator = Tessellator.instance;
743   - tessellator.startDrawingQuads();
744   - tessellator.addVertexWithUV(x + 0, y + height, 0, u , v2);
745   - tessellator.addVertexWithUV(x + width, y + height, 0, u2, v2);
746   - tessellator.addVertexWithUV(x + width, y + 0, 0, u2, v );
747   - tessellator.addVertexWithUV(x + 0, y + 0, 0, u , v );
  744 + Tessellator tessellator = Tessellator.getInstance();
  745 + WorldRenderer worldRenderer = tessellator.getWorldRenderer();
  746 + worldRenderer.startDrawingQuads();
  747 + worldRenderer.addVertexWithUV(x + 0, y + height, 0, u , v2);
  748 + worldRenderer.addVertexWithUV(x + width, y + height, 0, u2, v2);
  749 + worldRenderer.addVertexWithUV(x + width, y + 0, 0, u2, v );
  750 + worldRenderer.addVertexWithUV(x + 0, y + 0, 0, u , v );
748 751 tessellator.draw();
749 752  
750   - glDisable(GL_BLEND);
  753 + glEnableBlend();
751 754 glAlphaFunc(GL_GREATER, 0.01F);
752 755 }
753 756  
... ... @@ -757,7 +760,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
757 760 * @param y
758 761 * @param icon
759 762 */
760   - static void glDrawTexturedRect(int x, int y, IIcon icon, float alpha)
  763 + static void glDrawTexturedRect(int x, int y, Icon icon, float alpha)
761 764 {
762 765 glDrawTexturedRect(x, y, icon.getIconWidth(), icon.getIconHeight(), icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), alpha);
763 766 }
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiModListPanel.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
3 4 import static com.mumfrey.liteloader.client.util.GLClippingPlanes.*;
4   -import static org.lwjgl.opengl.GL11.*;
5 5  
6 6 import java.util.ArrayList;
7 7 import java.util.List;
... ... @@ -142,10 +142,10 @@ public class GuiModListPanel extends Gui
142 142 glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
143 143 Minecraft.getMinecraft().getTextureManager().bindTexture(icon.getTextureResource());
144 144  
145   - glEnable(GL_BLEND);
  145 + glEnableBlend();
146 146 this.drawTexturedModalRect(xPosition, yPosition, icon.getUPos(), icon.getVPos(), icon.getIconWidth(), icon.getIconHeight());
147   - glDisable(GL_BLEND);
148   -
  147 + glDisableBlend();
  148 +
149 149 if (mouseX >= xPosition && mouseX <= xPosition + 12 && mouseY >= yPosition && mouseY <= yPosition + 12)
150 150 {
151 151 String tooltipText = icon.getDisplayText();
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiPanel.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
3   -import static org.lwjgl.opengl.GL11.*;
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
4 4  
5 5 import java.util.LinkedList;
6 6 import java.util.List;
... ... @@ -200,11 +200,11 @@ public abstract class GuiPanel extends Gui
200 200 */
201 201 protected void drawThrobber(int x, int y, int frame)
202 202 {
203   - glEnable(GL_BLEND);
  203 + glEnableBlend();
204 204 glAlphaFunc(GL_GREATER, 0.0F);
205 205 this.mc.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE);
206 206 drawTexturedModalRect(x, y, (frame % 4) * 16, 171 + (((frame / 4) % 3) * 16), 16, 16);
207 207 glAlphaFunc(GL_GREATER, 0.1F);
208   - glDisable(GL_BLEND);
  208 + glDisableBlend();
209 209 }
210 210 }
211 211 \ No newline at end of file
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiPanelAbout.java
... ... @@ -10,7 +10,6 @@ import net.minecraft.client.Minecraft;
10 10 import net.minecraft.client.gui.FontRenderer;
11 11 import net.minecraft.client.gui.GuiButton;
12 12 import net.minecraft.client.resources.I18n;
13   -import net.minecraft.util.IIcon;
14 13 import net.minecraft.util.ResourceLocation;
15 14  
16 15 import org.lwjgl.input.Keyboard;
... ... @@ -18,6 +17,7 @@ import org.lwjgl.input.Keyboard;
18 17 import com.mumfrey.liteloader.api.BrandingProvider;
19 18 import com.mumfrey.liteloader.api.LiteAPI;
20 19 import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  20 +import com.mumfrey.liteloader.client.util.render.Icon;
21 21 import com.mumfrey.liteloader.client.util.render.IconAbsolute;
22 22 import com.mumfrey.liteloader.core.LiteLoader;
23 23 import com.mumfrey.liteloader.util.SortableValue;
... ... @@ -124,7 +124,7 @@ class GuiPanelAbout extends GuiPanel implements ScrollPanelContent
124 124 for (BrandingProvider branding : this.brandings)
125 125 {
126 126 ResourceLocation twitterAvatarResource = branding.getTwitterAvatarResource();
127   - IIcon twitterAvatarCoords = branding.getTwitterAvatarCoords();
  127 + Icon twitterAvatarCoords = branding.getTwitterAvatarCoords();
128 128  
129 129 this.mc.getTextureManager().bindTexture(twitterAvatarResource != null ? twitterAvatarResource : LiteLoaderBrandingProvider.ABOUT_TEXTURE);
130 130 GuiLiteLoaderPanel.glDrawTexturedRect(0, yPos, twitterAvatarCoords != null ? twitterAvatarCoords : GuiPanelAbout.apiIconCoords, 1.0F);
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiPanelConfigContainer.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
3 4 import static com.mumfrey.liteloader.client.util.GLClippingPlanes.*;
4   -import static org.lwjgl.opengl.GL11.*;
5 5 import net.minecraft.client.Minecraft;
6 6 import net.minecraft.client.gui.GuiButton;
7 7 import net.minecraft.client.resources.I18n;
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiPanelLiteLoaderLog.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
3   -import static org.lwjgl.opengl.GL11.*;
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
4 4  
5 5 import java.net.URI;
6 6 import java.util.ArrayList;
... ... @@ -14,6 +14,7 @@ import net.minecraft.util.Session;
14 14  
15 15 import org.lwjgl.input.Keyboard;
16 16  
  17 +import com.mumfrey.liteloader.core.LiteLoader;
17 18 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
18 19 import com.mumfrey.liteloader.util.net.LiteLoaderLogUpload;
19 20  
... ... @@ -50,6 +51,8 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent
50 51  
51 52 private GuiLiteLoaderPanel parent;
52 53  
  54 + private int debugInfoTimer = 0;
  55 +
53 56 /**
54 57 * @param parent
55 58 * @param minecraft
... ... @@ -157,6 +160,19 @@ class GuiPanelLiteLoaderLog extends GuiPanel implements ScrollPanelContent
157 160 this.logURL = null;
158 161 this.setSize(this.width, this.height);
159 162 }
  163 +
  164 + if (Keyboard.isKeyDown(Keyboard.KEY_F3))
  165 + {
  166 + this.debugInfoTimer++;
  167 + if (this.debugInfoTimer == 60)
  168 + {
  169 + LiteLoader.dumpDebugInfo();
  170 + }
  171 + }
  172 + else
  173 + {
  174 + this.debugInfoTimer = 0;
  175 + }
160 176 }
161 177  
162 178 /**
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiPanelMods.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
3 4 import static com.mumfrey.liteloader.client.util.GLClippingPlanes.*;
4   -import static org.lwjgl.opengl.GL11.*;
5 5  
6 6 import java.util.ArrayList;
7 7 import java.util.List;
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiScrollPanel.java
1 1 package com.mumfrey.liteloader.client.gui;
2 2  
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
3 4 import static com.mumfrey.liteloader.client.util.GLClippingPlanes.*;
4   -import static org.lwjgl.opengl.GL11.*;
5 5 import net.minecraft.client.Minecraft;
6 6 import net.minecraft.client.gui.GuiButton;
7 7  
... ...
java/client/com/mumfrey/liteloader/client/gui/startup/LoadingBar.java
1 1 package com.mumfrey.liteloader.client.gui.startup;
2 2  
3   -import static org.lwjgl.opengl.GL11.*;
  3 +import static com.mumfrey.liteloader.client.util.GL.*;
4 4  
5 5 import java.awt.image.BufferedImage;
6 6 import java.io.IOException;
... ... @@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
14 14 import net.minecraft.client.gui.FontRenderer;
15 15 import net.minecraft.client.gui.ScaledResolution;
16 16 import net.minecraft.client.renderer.Tessellator;
  17 +import net.minecraft.client.renderer.WorldRenderer;
17 18 import net.minecraft.client.renderer.texture.DynamicTexture;
18 19 import net.minecraft.client.renderer.texture.ITextureObject;
19 20 import net.minecraft.client.renderer.texture.TextureManager;
... ... @@ -245,19 +246,20 @@ public class LoadingBar extends LoadingProgress
245 246  
246 247 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
247 248  
248   - glDisable(GL_LIGHTING);
249   - glDisable(GL_FOG);
250   - glDisable(GL_DEPTH_TEST);
251   - glEnable(GL_TEXTURE_2D);
  249 + glDisableLighting();
  250 + glDisableFog();
  251 + glDisableDepth();
  252 + glEnableTexture2D();
252 253  
253 254 this.textureManager.bindTexture(this.textureLocation);
254   - Tessellator tessellator = Tessellator.instance;
255   - tessellator.startDrawingQuads();
256   - tessellator.setColorOpaque_I(0xFFFFFFFF);
257   - tessellator.addVertexWithUV(0.0D, scaledHeight, 0.0D, 0.0D, 0.0D);
258   - tessellator.addVertexWithUV(scaledWidth, scaledHeight, 0.0D, 0.0D, 0.0D);
259   - tessellator.addVertexWithUV(scaledWidth, 0.0D, 0.0D, 0.0D, 0.0D);
260   - tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
  255 + Tessellator tessellator = Tessellator.getInstance();
  256 + WorldRenderer worldRenderer = tessellator.getWorldRenderer();
  257 + worldRenderer.startDrawingQuads();
  258 + worldRenderer.setColorOpaque_I(0xFFFFFFFF); // TODO OBF MCPTEST func_178991_c - setColorOpaque_I
  259 + worldRenderer.addVertexWithUV(0.0D, scaledHeight, 0.0D, 0.0D, 0.0D);
  260 + worldRenderer.addVertexWithUV(scaledWidth, scaledHeight, 0.0D, 0.0D, 0.0D);
  261 + worldRenderer.addVertexWithUV(scaledWidth, 0.0D, 0.0D, 0.0D, 0.0D);
  262 + worldRenderer.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
261 263 tessellator.draw();
262 264  
263 265 glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
... ... @@ -270,16 +272,17 @@ public class LoadingBar extends LoadingProgress
270 272 int v2 = 256;
271 273  
272 274 float texMapScale = 0.00390625F;
273   - tessellator.startDrawingQuads();
274   - tessellator.setColorOpaque_I(0xFFFFFFFF);
275   - tessellator.addVertexWithUV(left + 0, top + v2, 0.0D, (u1 + 0) * texMapScale, (v1 + v2) * texMapScale);
276   - tessellator.addVertexWithUV(left + u2, top + v2, 0.0D, (u1 + u2) * texMapScale, (v1 + v2) * texMapScale);
277   - tessellator.addVertexWithUV(left + u2, top + 0, 0.0D, (u1 + u2) * texMapScale, (v1 + 0) * texMapScale);
278   - tessellator.addVertexWithUV(left + 0, top + 0, 0.0D, (u1 + 0) * texMapScale, (v1 + 0) * texMapScale);
  275 + worldRenderer.startDrawingQuads();
  276 + worldRenderer.setColorOpaque_I(0xFFFFFFFF); // TODO OBF MCPTEST func_178991_c - setColorOpaque_I
  277 + worldRenderer.addVertexWithUV(left + 0, top + v2, 0.0D, (u1 + 0) * texMapScale, (v1 + v2) * texMapScale);
  278 + worldRenderer.addVertexWithUV(left + u2, top + v2, 0.0D, (u1 + u2) * texMapScale, (v1 + v2) * texMapScale);
  279 + worldRenderer.addVertexWithUV(left + u2, top + 0, 0.0D, (u1 + u2) * texMapScale, (v1 + 0) * texMapScale);
  280 + worldRenderer.addVertexWithUV(left + 0, top + 0, 0.0D, (u1 + 0) * texMapScale, (v1 + 0) * texMapScale);
279 281 tessellator.draw();
280 282  
281   - glEnable(GL_COLOR_LOGIC_OP);
282   - glLogicOp(GL_OR_REVERSE);
  283 + glEnableTexture2D();
  284 + glEnableColorLogic();
  285 + glColorLogicOp(GL_OR_REVERSE);
283 286 this.fontRenderer.drawString(this.message, 1, scaledHeight - 19, 0xFF000000);
284 287  
285 288 if (LiteLoaderLogger.DEBUG)
... ... @@ -292,16 +295,16 @@ public class LoadingBar extends LoadingProgress
292 295 glPopMatrix();
293 296 }
294 297  
295   - glDisable(GL_COLOR_LOGIC_OP);
296   - glEnable(GL_TEXTURE_2D);
  298 + glDisableColorLogic();
  299 + glEnableTexture2D();
297 300  
298 301 double barHeight = 10.0D;
299 302  
300 303 double barWidth = scaledResolution.getScaledWidth_double() - 2.0D;
301 304  
302   - glDisable(GL_TEXTURE_2D);
303   - glEnable(GL_BLEND);
304   - glEnable(GL_ALPHA_TEST);
  305 + glDisableTexture2D();
  306 + glEnableBlend();
  307 + glEnableAlpha();
305 308 glAlphaFunc(GL_GREATER, 0.0F);
306 309 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
307 310  
... ... @@ -315,37 +318,37 @@ public class LoadingBar extends LoadingProgress
315 318 // tessellator.addVertex(0.0D, scaledHeight - (scaledHeight / 3), 0.0D);
316 319 // tessellator.draw();
317 320  
318   - tessellator.startDrawingQuads();
319   - tessellator.setColorRGBA(this.barLuma, this.barLuma, this.barLuma, 128);
320   - tessellator.addVertex(0.0D, scaledHeight, 0.0D);
321   - tessellator.addVertex(0.0D + scaledWidth, scaledHeight, 0.0D);
322   - tessellator.addVertex(0.0D + scaledWidth, scaledHeight - barHeight, 0.0D);
323   - tessellator.addVertex(0.0D, scaledHeight - barHeight, 0.0D);
  321 + worldRenderer.startDrawingQuads();
  322 + worldRenderer.func_178961_b(this.barLuma, this.barLuma, this.barLuma, 128);
  323 + worldRenderer.addVertex(0.0D, scaledHeight, 0.0D);
  324 + worldRenderer.addVertex(0.0D + scaledWidth, scaledHeight, 0.0D);
  325 + worldRenderer.addVertex(0.0D + scaledWidth, scaledHeight - barHeight, 0.0D);
  326 + worldRenderer.addVertex(0.0D, scaledHeight - barHeight, 0.0D);
324 327 tessellator.draw();
325 328  
326 329 barHeight -= 1;
327 330  
328   - tessellator.startDrawingQuads();
329   - tessellator.setColorRGBA(this.r2, this.g2, this.b2, 255);
330   - tessellator.addVertex(1.0D + barWidth * progress, scaledHeight - 1, 1.0D);
331   - tessellator.addVertex(1.0D + barWidth * progress, scaledHeight - barHeight, 1.0D);
332   - tessellator.setColorRGBA(0, 0, 0, 255);
333   - tessellator.addVertex(1.0D, scaledHeight - barHeight, 1.0D);
334   - tessellator.addVertex(1.0D, scaledHeight - 1, 1.0D);
  331 + worldRenderer.startDrawingQuads();
  332 + worldRenderer.func_178961_b(this.r2, this.g2, this.b2, 255);
  333 + worldRenderer.addVertex(1.0D + barWidth * progress, scaledHeight - 1, 1.0D);
  334 + worldRenderer.addVertex(1.0D + barWidth * progress, scaledHeight - barHeight, 1.0D);
  335 + worldRenderer.func_178961_b(0, 0, 0, 255);
  336 + worldRenderer.addVertex(1.0D, scaledHeight - barHeight, 1.0D);
  337 + worldRenderer.addVertex(1.0D, scaledHeight - 1, 1.0D);
335 338 tessellator.draw();
336 339  
337 340 glAlphaFunc(GL_GREATER, 0.1F);
338   - glDisable(GL_LIGHTING);
339   - glDisable(GL_FOG);
  341 + glDisableLighting();
  342 + glDisableFog();
340 343 this.fbo.unbindFramebuffer();
341 344  
342 345 this.fbo.framebufferRender(fboWidth, fboHeight);
343 346  
344   - glEnable(GL_ALPHA_TEST);
  347 + glEnableAlpha();
345 348 glAlphaFunc(GL_GREATER, 0.1F);
346   - glFlush();
  349 +// glFlush();
347 350  
348   - this.minecraft.resetSize();
  351 + this.minecraft.updateDisplay(); // TODO OBF MCPTEST updateDisplay - func_175601_h
349 352 }
350 353  
351 354 private void renderLogTail(int yPos)
... ...
java/client/com/mumfrey/liteloader/client/overlays/MinecraftOverlay.java
... ... @@ -25,14 +25,14 @@ public abstract class MinecraftOverlay implements IMinecraft
25 25 @SuppressWarnings("unused")
26 26 private static Minecraft __TARGET;
27 27  
28   - // TODO Obfuscation 1.7.10
  28 + // TODO Obfuscation 1.8
29 29 // Fields
30   - @Obfuscated({"field_71428_T", "Q"}) private Timer timer;
31   - @Obfuscated({"field_71424_I", "z"}) private Profiler mcProfiler;
32   - @Obfuscated({"field_71425_J", "A"}) private boolean running;
33   - @Obfuscated({"field_110449_ao", "ap"}) private List<?> defaultResourcePacks = Lists.newArrayList();
34   - @Obfuscated({"field_71475_ae", "af"}) private String serverName;
35   - @Obfuscated({"field_71477_af", "ag"}) private int serverPort;
  30 + @Obfuscated({"field_71428_T", "U"}) private Timer timer;
  31 + @Obfuscated({"field_71424_I", "y"}) private Profiler mcProfiler;
  32 + @Obfuscated({"field_71425_J", "z"}) private boolean running;
  33 + @Obfuscated({"field_110449_ao", "aw"}) private List<?> defaultResourcePacks = Lists.newArrayList();
  34 + @Obfuscated({"field_71475_ae", "am"}) private String serverName;
  35 + @Obfuscated({"field_71477_af", "an"}) private int serverPort;
36 36  
37 37 // Methods
38 38 @Obfuscated({"func_71370_a", "a"}) @Stub abstract void resize(int width, int height);
... ...
java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java
... ... @@ -9,15 +9,22 @@ import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
9 9 import com.mumfrey.liteloader.transformers.event.InjectionPoint;
10 10 import com.mumfrey.liteloader.transformers.event.MethodInfo;
11 11 import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
  12 +import com.mumfrey.liteloader.transformers.event.inject.BeforeNew;
12 13 import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
13 14 import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke;
14 15 import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
15 16  
  17 +/**
  18 + * Injector for LiteLoader's main events
  19 + *
  20 + * @author Adam Mummery-Smith
  21 + */
16 22 public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer
17 23 {
18 24 @Override
19 25 protected void addEvents()
20 26 {
  27 + // Event declaraions
21 28 Event onOutboundChat = Event.getOrCreate("onOutboundChat", true);
22 29 Event onResize = Event.getOrCreate("updateFramebufferSize", false);
23 30 Event preRenderFBO = Event.getOrCreate("preRenderFBO", false);
... ... @@ -43,7 +50,9 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
43 50 Event onSpawnPlayer = Event.getOrCreate("onSpawnPlayer", false);
44 51 Event onRespawnPlayer = Event.getOrCreate("onRespawnPlayer", false);
45 52 Event onStartupComplete = Event.getOrCreate("onStartupComplete", false);
  53 + Event onSessionProfileBad = Event.getOrCreate("onSessionProfileBad", true);
46 54  
  55 + // Injection Points
47 56 InjectionPoint methodHead = new MethodHead();
48 57 InjectionPoint methodReturn = new BeforeReturn();
49 58 InjectionPoint beforeGlClear = new BeforeInvoke(glClear);
... ... @@ -54,17 +63,19 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
54 63 InjectionPoint beforeDrawChat = new BeforeInvoke(drawChat);
55 64 InjectionPoint beforeEndProfiler = new BeforeInvoke(endSection);
56 65 InjectionPoint beforeTickProfiler = new BeforeStringInvoke("tick", startSection);
57   - InjectionPoint beforePickProfiler = new BeforeStringInvoke("pick", endStartSection);
  66 + InjectionPoint beforeCenterProfiler = new BeforeStringInvoke("center", startSection);
58 67 InjectionPoint beforeRenderProfiler = new BeforeStringInvoke("gameRenderer", endStartSection);
59   - InjectionPoint beforeFrustumProfiler = new BeforeStringInvoke("frustrum", endStartSection);
  68 + InjectionPoint beforeFrustumProfiler = new BeforeStringInvoke("frustum", endStartSection);
60 69 InjectionPoint beforeParticlesProfiler = new BeforeStringInvoke("litParticles", endStartSection);
  70 + InjectionPoint beforeNewGameProfile = new BeforeNew(1, Obf.GameProfile);
61 71  
  72 + // Hooks
62 73 this.add(onOutboundChat, sendChatMessage, (methodHead), "onOutboundChat");
63 74 this.add(onResize, updateFramebufferSize, (methodHead), "onResize");
64 75 this.add(preRenderFBO, runGameLoop, (beforeFBORender), "preRenderFBO");
65   - this.add(renderFBO, framebufferRender, (beforeBindFBOTex), "renderFBO");
  76 + this.add(renderFBO, framebufferRenderExt, (beforeBindFBOTex), "renderFBO");
66 77 this.add(postRenderFBO, runGameLoop, after(beforeFBORender), "postRenderFBO");
67   - this.add(onRenderWorld, renderWorld, (beforePickProfiler), "onRenderWorld");
  78 + this.add(onRenderWorld, renderWorld, (beforeCenterProfiler), "onRenderWorld");
68 79 this.add(onTimerUpdate, runGameLoop, (beforeTickProfiler), "onTimerUpdate");
69 80 this.add(onRender, runGameLoop, (beforeRenderProfiler), "onRender");
70 81 this.add(newTick, runTick, (methodHead), "newTick");
... ... @@ -72,8 +83,8 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
72 83 this.add(preRenderGUI, updateCameraAndRender, after(beforeGlClear), "preRenderGUI");
73 84 this.add(onRenderHUD, updateCameraAndRender, (beforeRenderHUD), "onRenderHUD");
74 85 this.add(postRenderHUD, updateCameraAndRender, after(beforeRenderHUD), "postRenderHUD");
75   - this.add(onSetupCameraTransform, renderWorld, (beforeFrustumProfiler), "onSetupCameraTransform");
76   - this.add(postRenderEntities, renderWorld, (beforeParticlesProfiler), "postRenderEntities");
  86 + this.add(onSetupCameraTransform, renderWorldPass, (beforeFrustumProfiler), "onSetupCameraTransform");
  87 + this.add(postRenderEntities, renderWorldPass, (beforeParticlesProfiler), "postRenderEntities");
77 88 this.add(postRender, renderWorld, (beforeEndProfiler), "postRender");
78 89 this.add(onRenderChat, renderGameOverlay, (beforeDrawChat), "onRenderChat");
79 90 this.add(postRenderChat, renderGameOverlay, after(beforeDrawChat), "postRenderChat");
... ... @@ -84,6 +95,9 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
84 95 this.add(onSpawnPlayer, spawnPlayer, (methodReturn), "onSpawnPlayer");
85 96 this.add(onRespawnPlayer, respawnPlayer, (methodReturn), "onRespawnPlayer");
86 97 this.add(onStartupComplete, startGame, (methodReturn), "onStartupComplete");
  98 +
  99 + // Compatibility handlers
  100 + this.add(onSessionProfileBad, getProfile, (beforeNewGameProfile), "generateOfflineUUID");
87 101 }
88 102  
89 103 protected final Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback)
... ...
java/client/com/mumfrey/liteloader/client/util/GL.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.util;
  2 +
  3 +import java.nio.FloatBuffer;
  4 +
  5 +import net.minecraft.client.renderer.GlStateManager;
  6 +import net.minecraft.client.renderer.GlStateManager.TexGen;
  7 +
  8 +/**
  9 + * Convenience class for working with Mojang's GLStateManager:
  10 + *
  11 + * It would be pretty tolerable to work with GLStateManager as a static import were it not for the fact that you still need to
  12 + * import the GL namespaces themselves from LWJGL in order to get the constants, and also have to deal with the fact that
  13 + * GLStateManager's methods don't have "gl-style" names, making it annoying to work with. This class is designed to function as
  14 + * an adapter to allow changeover to be more painless. Using this class means that the following code:
  15 + *
  16 + * glEnable(GL_BLEND);
  17 + * glAlphaFunc(GL_GREATER, 0.0F);
  18 + *
  19 + * becomes:
  20 + *
  21 + * glEnableBlend();
  22 + * glAlphaFunc(GL_GREATER, 0.0F);
  23 + *
  24 + * Notice that the glAlphaFunc invokation remains unchanged, and the glEnable call simply gets replaced with a logical equivalent
  25 + * which invokes the GLStateManager method behind the scenes.
  26 + *
  27 + * To use this class, simply replace existing static imports in your classes with this single static import, then change glEnable
  28 + * and glDisable calls accordingly.
  29 + *
  30 + * @author Adam Mummery-Smith
  31 + */
  32 +public class GL
  33 +{
  34 + // GL11
  35 + public static final int GL_ACCUM = 0x100;
  36 + public static final int GL_LOAD = 0x101;
  37 + public static final int GL_RETURN = 0x102;
  38 + public static final int GL_MULT = 0x103;
  39 + public static final int GL_ADD = 0x104;
  40 + public static final int GL_NEVER = 0x200;
  41 + public static final int GL_LESS = 0x201;
  42 + public static final int GL_EQUAL = 0x202;
  43 + public static final int GL_LEQUAL = 0x203;
  44 + public static final int GL_GREATER = 0x204;
  45 + public static final int GL_NOTEQUAL = 0x205;
  46 + public static final int GL_GEQUAL = 0x206;
  47 + public static final int GL_ALWAYS = 0x207;
  48 + public static final int GL_CURRENT_BIT = 0x1;
  49 + public static final int GL_POINT_BIT = 0x2;
  50 + public static final int GL_LINE_BIT = 0x4;
  51 + public static final int GL_POLYGON_BIT = 0x8;
  52 + public static final int GL_POLYGON_STIPPLE_BIT = 0x10;
  53 + public static final int GL_PIXEL_MODE_BIT = 0x20;
  54 + public static final int GL_LIGHTING_BIT = 0x40;
  55 + public static final int GL_FOG_BIT = 0x80;
  56 + public static final int GL_DEPTH_BUFFER_BIT = 0x100;
  57 + public static final int GL_ACCUM_BUFFER_BIT = 0x200;
  58 + public static final int GL_STENCIL_BUFFER_BIT = 0x400;
  59 + public static final int GL_VIEWPORT_BIT = 0x800;
  60 + public static final int GL_TRANSFORM_BIT = 0x1000;
  61 + public static final int GL_ENABLE_BIT = 0x2000;
  62 + public static final int GL_COLOR_BUFFER_BIT = 0x4000;
  63 + public static final int GL_HINT_BIT = 0x8000;
  64 + public static final int GL_EVAL_BIT = 0x10000;
  65 + public static final int GL_LIST_BIT = 0x20000;
  66 + public static final int GL_TEXTURE_BIT = 0x40000;
  67 + public static final int GL_SCISSOR_BIT = 0x80000;
  68 + public static final int GL_ALL_ATTRIB_BITS = 0xfffff;
  69 + public static final int GL_POINTS = 0x0;
  70 + public static final int GL_LINES = 0x1;
  71 + public static final int GL_LINE_LOOP = 0x2;
  72 + public static final int GL_LINE_STRIP = 0x3;
  73 + public static final int GL_TRIANGLES = 0x4;
  74 + public static final int GL_TRIANGLE_STRIP = 0x5;
  75 + public static final int GL_TRIANGLE_FAN = 0x6;
  76 + public static final int GL_QUADS = 0x7;
  77 + public static final int GL_QUAD_STRIP = 0x8;
  78 + public static final int GL_POLYGON = 0x9;
  79 + public static final int GL_ZERO = 0x0;
  80 + public static final int GL_ONE = 0x1;
  81 + public static final int GL_SRC_COLOR = 0x300;
  82 + public static final int GL_ONE_MINUS_SRC_COLOR = 0x301;
  83 + public static final int GL_SRC_ALPHA = 0x302;
  84 + public static final int GL_ONE_MINUS_SRC_ALPHA = 0x303;
  85 + public static final int GL_DST_ALPHA = 0x304;
  86 + public static final int GL_ONE_MINUS_DST_ALPHA = 0x305;
  87 + public static final int GL_DST_COLOR = 0x306;
  88 + public static final int GL_ONE_MINUS_DST_COLOR = 0x307;
  89 + public static final int GL_SRC_ALPHA_SATURATE = 0x308;
  90 + public static final int GL_CONSTANT_COLOR = 0x8001;
  91 + public static final int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002;
  92 + public static final int GL_CONSTANT_ALPHA = 0x8003;
  93 + public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004;
  94 + public static final int GL_TRUE = 0x1;
  95 + public static final int GL_FALSE = 0x0;
  96 + public static final int GL_CLIP_PLANE0 = 0x3000;
  97 + public static final int GL_CLIP_PLANE1 = 0x3001;
  98 + public static final int GL_CLIP_PLANE2 = 0x3002;
  99 + public static final int GL_CLIP_PLANE3 = 0x3003;
  100 + public static final int GL_CLIP_PLANE4 = 0x3004;
  101 + public static final int GL_CLIP_PLANE5 = 0x3005;
  102 + public static final int GL_BYTE = 0x1400;
  103 + public static final int GL_UNSIGNED_BYTE = 0x1401;
  104 + public static final int GL_SHORT = 0x1402;
  105 + public static final int GL_UNSIGNED_SHORT = 0x1403;
  106 + public static final int GL_INT = 0x1404;
  107 + public static final int GL_UNSIGNED_INT = 0x1405;
  108 + public static final int GL_FLOAT = 0x1406;
  109 + public static final int GL_2_BYTES = 0x1407;
  110 + public static final int GL_3_BYTES = 0x1408;
  111 + public static final int GL_4_BYTES = 0x1409;
  112 + public static final int GL_DOUBLE = 0x140a;
  113 + public static final int GL_NONE = 0x0;
  114 + public static final int GL_FRONT_LEFT = 0x400;
  115 + public static final int GL_FRONT_RIGHT = 0x401;
  116 + public static final int GL_BACK_LEFT = 0x402;
  117 + public static final int GL_BACK_RIGHT = 0x403;
  118 + public static final int GL_FRONT = 0x404;
  119 + public static final int GL_BACK = 0x405;
  120 + public static final int GL_LEFT = 0x406;
  121 + public static final int GL_RIGHT = 0x407;
  122 + public static final int GL_FRONT_AND_BACK = 0x408;
  123 + public static final int GL_AUX0 = 0x409;
  124 + public static final int GL_AUX1 = 0x40a;
  125 + public static final int GL_AUX2 = 0x40b;
  126 + public static final int GL_AUX3 = 0x40c;
  127 + public static final int GL_NO_ERROR = 0x0;
  128 + public static final int GL_INVALID_ENUM = 0x500;
  129 + public static final int GL_INVALID_VALUE = 0x501;
  130 + public static final int GL_INVALID_OPERATION = 0x502;
  131 + public static final int GL_STACK_OVERFLOW = 0x503;
  132 + public static final int GL_STACK_UNDERFLOW = 0x504;
  133 + public static final int GL_OUT_OF_MEMORY = 0x505;
  134 + public static final int GL_2D = 0x600;
  135 + public static final int GL_3D = 0x601;
  136 + public static final int GL_3D_COLOR = 0x602;
  137 + public static final int GL_3D_COLOR_TEXTURE = 0x603;
  138 + public static final int GL_4D_COLOR_TEXTURE = 0x604;
  139 + public static final int GL_PASS_THROUGH_TOKEN = 0x700;
  140 + public static final int GL_POINT_TOKEN = 0x701;
  141 + public static final int GL_LINE_TOKEN = 0x702;
  142 + public static final int GL_POLYGON_TOKEN = 0x703;
  143 + public static final int GL_BITMAP_TOKEN = 0x704;
  144 + public static final int GL_DRAW_PIXEL_TOKEN = 0x705;
  145 + public static final int GL_COPY_PIXEL_TOKEN = 0x706;
  146 + public static final int GL_LINE_RESET_TOKEN = 0x707;
  147 + public static final int GL_EXP = 0x800;
  148 + public static final int GL_EXP2 = 0x801;
  149 + public static final int GL_CW = 0x900;
  150 + public static final int GL_CCW = 0x901;
  151 + public static final int GL_COEFF = 0xa00;
  152 + public static final int GL_ORDER = 0xa01;
  153 + public static final int GL_DOMAIN = 0xa02;
  154 + public static final int GL_CURRENT_COLOR = 0xb00;
  155 + public static final int GL_CURRENT_INDEX = 0xb01;
  156 + public static final int GL_CURRENT_NORMAL = 0xb02;
  157 + public static final int GL_CURRENT_TEXTURE_COORDS = 0xb03;
  158 + public static final int GL_CURRENT_RASTER_COLOR = 0xb04;
  159 + public static final int GL_CURRENT_RASTER_INDEX = 0xb05;
  160 + public static final int GL_CURRENT_RASTER_TEXTURE_COORDS = 0xb06;
  161 + public static final int GL_CURRENT_RASTER_POSITION = 0xb07;
  162 + public static final int GL_CURRENT_RASTER_POSITION_VALID = 0xb08;
  163 + public static final int GL_CURRENT_RASTER_DISTANCE = 0xb09;
  164 + public static final int GL_POINT_SMOOTH = 0xb10;
  165 + public static final int GL_POINT_SIZE = 0xb11;
  166 + public static final int GL_POINT_SIZE_RANGE = 0xb12;
  167 + public static final int GL_POINT_SIZE_GRANULARITY = 0xb13;
  168 + public static final int GL_LINE_SMOOTH = 0xb20;
  169 + public static final int GL_LINE_WIDTH = 0xb21;
  170 + public static final int GL_LINE_WIDTH_RANGE = 0xb22;
  171 + public static final int GL_LINE_WIDTH_GRANULARITY = 0xb23;
  172 + public static final int GL_LINE_STIPPLE = 0xb24;
  173 + public static final int GL_LINE_STIPPLE_PATTERN = 0xb25;
  174 + public static final int GL_LINE_STIPPLE_REPEAT = 0xb26;
  175 + public static final int GL_LIST_MODE = 0xb30;
  176 + public static final int GL_MAX_LIST_NESTING = 0xb31;
  177 + public static final int GL_LIST_BASE = 0xb32;
  178 + public static final int GL_LIST_INDEX = 0xb33;
  179 + public static final int GL_POLYGON_MODE = 0xb40;
  180 + public static final int GL_POLYGON_SMOOTH = 0xb41;
  181 + public static final int GL_POLYGON_STIPPLE = 0xb42;
  182 + public static final int GL_EDGE_FLAG = 0xb43;
  183 + public static final int GL_CULL_FACE = 0xb44;
  184 + public static final int GL_CULL_FACE_MODE = 0xb45;
  185 + public static final int GL_FRONT_FACE = 0xb46;
  186 + public static final int GL_LIGHTING = 0xb50;
  187 + public static final int GL_LIGHT_MODEL_LOCAL_VIEWER = 0xb51;
  188 + public static final int GL_LIGHT_MODEL_TWO_SIDE = 0xb52;
  189 + public static final int GL_LIGHT_MODEL_AMBIENT = 0xb53;
  190 + public static final int GL_SHADE_MODEL = 0xb54;
  191 + public static final int GL_COLOR_MATERIAL_FACE = 0xb55;
  192 + public static final int GL_COLOR_MATERIAL_PARAMETER = 0xb56;
  193 + public static final int GL_COLOR_MATERIAL = 0xb57;
  194 + public static final int GL_FOG = 0xb60;
  195 + public static final int GL_FOG_INDEX = 0xb61;
  196 + public static final int GL_FOG_DENSITY = 0xb62;
  197 + public static final int GL_FOG_START = 0xb63;
  198 + public static final int GL_FOG_END = 0xb64;
  199 + public static final int GL_FOG_MODE = 0xb65;
  200 + public static final int GL_FOG_COLOR = 0xb66;
  201 + public static final int GL_DEPTH_RANGE = 0xb70;
  202 + public static final int GL_DEPTH_TEST = 0xb71;
  203 + public static final int GL_DEPTH_WRITEMASK = 0xb72;
  204 + public static final int GL_DEPTH_CLEAR_VALUE = 0xb73;
  205 + public static final int GL_DEPTH_FUNC = 0xb74;
  206 + public static final int GL_ACCUM_CLEAR_VALUE = 0xb80;
  207 + public static final int GL_STENCIL_TEST = 0xb90;
  208 + public static final int GL_STENCIL_CLEAR_VALUE = 0xb91;
  209 + public static final int GL_STENCIL_FUNC = 0xb92;
  210 + public static final int GL_STENCIL_VALUE_MASK = 0xb93;
  211 + public static final int GL_STENCIL_FAIL = 0xb94;
  212 + public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0xb95;
  213 + public static final int GL_STENCIL_PASS_DEPTH_PASS = 0xb96;
  214 + public static final int GL_STENCIL_REF = 0xb97;
  215 + public static final int GL_STENCIL_WRITEMASK = 0xb98;
  216 + public static final int GL_MATRIX_MODE = 0xba0;
  217 + public static final int GL_NORMALIZE = 0xba1;
  218 + public static final int GL_VIEWPORT = 0xba2;
  219 + public static final int GL_MODELVIEW_STACK_DEPTH = 0xba3;
  220 + public static final int GL_PROJECTION_STACK_DEPTH = 0xba4;
  221 + public static final int GL_TEXTURE_STACK_DEPTH = 0xba5;
  222 + public static final int GL_MODELVIEW_MATRIX = 0xba6;
  223 + public static final int GL_PROJECTION_MATRIX = 0xba7;
  224 + public static final int GL_TEXTURE_MATRIX = 0xba8;
  225 + public static final int GL_ATTRIB_STACK_DEPTH = 0xbb0;
  226 + public static final int GL_CLIENT_ATTRIB_STACK_DEPTH = 0xbb1;
  227 + public static final int GL_ALPHA_TEST = 0xbc0;
  228 + public static final int GL_ALPHA_TEST_FUNC = 0xbc1;
  229 + public static final int GL_ALPHA_TEST_REF = 0xbc2;
  230 + public static final int GL_DITHER = 0xbd0;
  231 + public static final int GL_BLEND_DST = 0xbe0;
  232 + public static final int GL_BLEND_SRC = 0xbe1;
  233 + public static final int GL_BLEND = 0xbe2;
  234 + public static final int GL_LOGIC_OP_MODE = 0xbf0;
  235 + public static final int GL_INDEX_LOGIC_OP = 0xbf1;
  236 + public static final int GL_COLOR_LOGIC_OP = 0xbf2;
  237 + public static final int GL_AUX_BUFFERS = 0xc00;
  238 + public static final int GL_DRAW_BUFFER = 0xc01;
  239 + public static final int GL_READ_BUFFER = 0xc02;
  240 + public static final int GL_SCISSOR_BOX = 0xc10;
  241 + public static final int GL_SCISSOR_TEST = 0xc11;
  242 + public static final int GL_INDEX_CLEAR_VALUE = 0xc20;
  243 + public static final int GL_INDEX_WRITEMASK = 0xc21;
  244 + public static final int GL_COLOR_CLEAR_VALUE = 0xc22;
  245 + public static final int GL_COLOR_WRITEMASK = 0xc23;
  246 + public static final int GL_INDEX_MODE = 0xc30;
  247 + public static final int GL_RGBA_MODE = 0xc31;
  248 + public static final int GL_DOUBLEBUFFER = 0xc32;
  249 + public static final int GL_STEREO = 0xc33;
  250 + public static final int GL_RENDER_MODE = 0xc40;
  251 + public static final int GL_PERSPECTIVE_CORRECTION_HINT = 0xc50;
  252 + public static final int GL_POINT_SMOOTH_HINT = 0xc51;
  253 + public static final int GL_LINE_SMOOTH_HINT = 0xc52;
  254 + public static final int GL_POLYGON_SMOOTH_HINT = 0xc53;
  255 + public static final int GL_FOG_HINT = 0xc54;
  256 + public static final int GL_TEXTURE_GEN_S = 0xc60;
  257 + public static final int GL_TEXTURE_GEN_T = 0xc61;
  258 + public static final int GL_TEXTURE_GEN_R = 0xc62;
  259 + public static final int GL_TEXTURE_GEN_Q = 0xc63;
  260 + public static final int GL_PIXEL_MAP_I_TO_I = 0xc70;
  261 + public static final int GL_PIXEL_MAP_S_TO_S = 0xc71;
  262 + public static final int GL_PIXEL_MAP_I_TO_R = 0xc72;
  263 + public static final int GL_PIXEL_MAP_I_TO_G = 0xc73;
  264 + public static final int GL_PIXEL_MAP_I_TO_B = 0xc74;
  265 + public static final int GL_PIXEL_MAP_I_TO_A = 0xc75;
  266 + public static final int GL_PIXEL_MAP_R_TO_R = 0xc76;
  267 + public static final int GL_PIXEL_MAP_G_TO_G = 0xc77;
  268 + public static final int GL_PIXEL_MAP_B_TO_B = 0xc78;
  269 + public static final int GL_PIXEL_MAP_A_TO_A = 0xc79;
  270 + public static final int GL_PIXEL_MAP_I_TO_I_SIZE = 0xcb0;
  271 + public static final int GL_PIXEL_MAP_S_TO_S_SIZE = 0xcb1;
  272 + public static final int GL_PIXEL_MAP_I_TO_R_SIZE = 0xcb2;
  273 + public static final int GL_PIXEL_MAP_I_TO_G_SIZE = 0xcb3;
  274 + public static final int GL_PIXEL_MAP_I_TO_B_SIZE = 0xcb4;
  275 + public static final int GL_PIXEL_MAP_I_TO_A_SIZE = 0xcb5;
  276 + public static final int GL_PIXEL_MAP_R_TO_R_SIZE = 0xcb6;
  277 + public static final int GL_PIXEL_MAP_G_TO_G_SIZE = 0xcb7;
  278 + public static final int GL_PIXEL_MAP_B_TO_B_SIZE = 0xcb8;
  279 + public static final int GL_PIXEL_MAP_A_TO_A_SIZE = 0xcb9;
  280 + public static final int GL_UNPACK_SWAP_BYTES = 0xcf0;
  281 + public static final int GL_UNPACK_LSB_FIRST = 0xcf1;
  282 + public static final int GL_UNPACK_ROW_LENGTH = 0xcf2;
  283 + public static final int GL_UNPACK_SKIP_ROWS = 0xcf3;
  284 + public static final int GL_UNPACK_SKIP_PIXELS = 0xcf4;
  285 + public static final int GL_UNPACK_ALIGNMENT = 0xcf5;
  286 + public static final int GL_PACK_SWAP_BYTES = 0xd00;
  287 + public static final int GL_PACK_LSB_FIRST = 0xd01;
  288 + public static final int GL_PACK_ROW_LENGTH = 0xd02;
  289 + public static final int GL_PACK_SKIP_ROWS = 0xd03;
  290 + public static final int GL_PACK_SKIP_PIXELS = 0xd04;
  291 + public static final int GL_PACK_ALIGNMENT = 0xd05;
  292 + public static final int GL_MAP_COLOR = 0xd10;
  293 + public static final int GL_MAP_STENCIL = 0xd11;
  294 + public static final int GL_INDEX_SHIFT = 0xd12;
  295 + public static final int GL_INDEX_OFFSET = 0xd13;
  296 + public static final int GL_RED_SCALE = 0xd14;
  297 + public static final int GL_RED_BIAS = 0xd15;
  298 + public static final int GL_ZOOM_X = 0xd16;
  299 + public static final int GL_ZOOM_Y = 0xd17;
  300 + public static final int GL_GREEN_SCALE = 0xd18;
  301 + public static final int GL_GREEN_BIAS = 0xd19;
  302 + public static final int GL_BLUE_SCALE = 0xd1a;
  303 + public static final int GL_BLUE_BIAS = 0xd1b;
  304 + public static final int GL_ALPHA_SCALE = 0xd1c;
  305 + public static final int GL_ALPHA_BIAS = 0xd1d;
  306 + public static final int GL_DEPTH_SCALE = 0xd1e;
  307 + public static final int GL_DEPTH_BIAS = 0xd1f;
  308 + public static final int GL_MAX_EVAL_ORDER = 0xd30;
  309 + public static final int GL_MAX_LIGHTS = 0xd31;
  310 + public static final int GL_MAX_CLIP_PLANES = 0xd32;
  311 + public static final int GL_MAX_TEXTURE_SIZE = 0xd33;
  312 + public static final int GL_MAX_PIXEL_MAP_TABLE = 0xd34;
  313 + public static final int GL_MAX_ATTRIB_STACK_DEPTH = 0xd35;
  314 + public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 0xd36;
  315 + public static final int GL_MAX_NAME_STACK_DEPTH = 0xd37;
  316 + public static final int GL_MAX_PROJECTION_STACK_DEPTH = 0xd38;
  317 + public static final int GL_MAX_TEXTURE_STACK_DEPTH = 0xd39;
  318 + public static final int GL_MAX_VIEWPORT_DIMS = 0xd3a;
  319 + public static final int GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0xd3b;
  320 + public static final int GL_SUBPIXEL_BITS = 0xd50;
  321 + public static final int GL_INDEX_BITS = 0xd51;
  322 + public static final int GL_RED_BITS = 0xd52;
  323 + public static final int GL_GREEN_BITS = 0xd53;
  324 + public static final int GL_BLUE_BITS = 0xd54;
  325 + public static final int GL_ALPHA_BITS = 0xd55;
  326 + public static final int GL_DEPTH_BITS = 0xd56;
  327 + public static final int GL_STENCIL_BITS = 0xd57;
  328 + public static final int GL_ACCUM_RED_BITS = 0xd58;
  329 + public static final int GL_ACCUM_GREEN_BITS = 0xd59;
  330 + public static final int GL_ACCUM_BLUE_BITS = 0xd5a;
  331 + public static final int GL_ACCUM_ALPHA_BITS = 0xd5b;
  332 + public static final int GL_NAME_STACK_DEPTH = 0xd70;
  333 + public static final int GL_AUTO_NORMAL = 0xd80;
  334 + public static final int GL_MAP1_COLOR_4 = 0xd90;
  335 + public static final int GL_MAP1_INDEX = 0xd91;
  336 + public static final int GL_MAP1_NORMAL = 0xd92;
  337 + public static final int GL_MAP1_TEXTURE_COORD_1 = 0xd93;
  338 + public static final int GL_MAP1_TEXTURE_COORD_2 = 0xd94;
  339 + public static final int GL_MAP1_TEXTURE_COORD_3 = 0xd95;
  340 + public static final int GL_MAP1_TEXTURE_COORD_4 = 0xd96;
  341 + public static final int GL_MAP1_VERTEX_3 = 0xd97;
  342 + public static final int GL_MAP1_VERTEX_4 = 0xd98;
  343 + public static final int GL_MAP2_COLOR_4 = 0xdb0;
  344 + public static final int GL_MAP2_INDEX = 0xdb1;
  345 + public static final int GL_MAP2_NORMAL = 0xdb2;
  346 + public static final int GL_MAP2_TEXTURE_COORD_1 = 0xdb3;
  347 + public static final int GL_MAP2_TEXTURE_COORD_2 = 0xdb4;
  348 + public static final int GL_MAP2_TEXTURE_COORD_3 = 0xdb5;
  349 + public static final int GL_MAP2_TEXTURE_COORD_4 = 0xdb6;
  350 + public static final int GL_MAP2_VERTEX_3 = 0xdb7;
  351 + public static final int GL_MAP2_VERTEX_4 = 0xdb8;
  352 + public static final int GL_MAP1_GRID_DOMAIN = 0xdd0;
  353 + public static final int GL_MAP1_GRID_SEGMENTS = 0xdd1;
  354 + public static final int GL_MAP2_GRID_DOMAIN = 0xdd2;
  355 + public static final int GL_MAP2_GRID_SEGMENTS = 0xdd3;
  356 + public static final int GL_TEXTURE_1D = 0xde0;
  357 + public static final int GL_TEXTURE_2D = 0xde1;
  358 + public static final int GL_FEEDBACK_BUFFER_POINTER = 0xdf0;
  359 + public static final int GL_FEEDBACK_BUFFER_SIZE = 0xdf1;
  360 + public static final int GL_FEEDBACK_BUFFER_TYPE = 0xdf2;
  361 + public static final int GL_SELECTION_BUFFER_POINTER = 0xdf3;
  362 + public static final int GL_SELECTION_BUFFER_SIZE = 0xdf4;
  363 + public static final int GL_TEXTURE_WIDTH = 0x1000;
  364 + public static final int GL_TEXTURE_HEIGHT = 0x1001;
  365 + public static final int GL_TEXTURE_INTERNAL_FORMAT = 0x1003;
  366 + public static final int GL_TEXTURE_BORDER_COLOR = 0x1004;
  367 + public static final int GL_TEXTURE_BORDER = 0x1005;
  368 + public static final int GL_DONT_CARE = 0x1100;
  369 + public static final int GL_FASTEST = 0x1101;
  370 + public static final int GL_NICEST = 0x1102;
  371 + public static final int GL_LIGHT0 = 0x4000;
  372 + public static final int GL_LIGHT1 = 0x4001;
  373 + public static final int GL_LIGHT2 = 0x4002;
  374 + public static final int GL_LIGHT3 = 0x4003;
  375 + public static final int GL_LIGHT4 = 0x4004;
  376 + public static final int GL_LIGHT5 = 0x4005;
  377 + public static final int GL_LIGHT6 = 0x4006;
  378 + public static final int GL_LIGHT7 = 0x4007;
  379 + public static final int GL_AMBIENT = 0x1200;
  380 + public static final int GL_DIFFUSE = 0x1201;
  381 + public static final int GL_SPECULAR = 0x1202;
  382 + public static final int GL_POSITION = 0x1203;
  383 + public static final int GL_SPOT_DIRECTION = 0x1204;
  384 + public static final int GL_SPOT_EXPONENT = 0x1205;
  385 + public static final int GL_SPOT_CUTOFF = 0x1206;
  386 + public static final int GL_CONSTANT_ATTENUATION = 0x1207;
  387 + public static final int GL_LINEAR_ATTENUATION = 0x1208;
  388 + public static final int GL_QUADRATIC_ATTENUATION = 0x1209;
  389 + public static final int GL_COMPILE = 0x1300;
  390 + public static final int GL_COMPILE_AND_EXECUTE = 0x1301;
  391 + public static final int GL_CLEAR = 0x1500;
  392 + public static final int GL_AND = 0x1501;
  393 + public static final int GL_AND_REVERSE = 0x1502;
  394 + public static final int GL_COPY = 0x1503;
  395 + public static final int GL_AND_INVERTED = 0x1504;
  396 + public static final int GL_NOOP = 0x1505;
  397 + public static final int GL_XOR = 0x1506;
  398 + public static final int GL_OR = 0x1507;
  399 + public static final int GL_NOR = 0x1508;
  400 + public static final int GL_EQUIV = 0x1509;
  401 + public static final int GL_INVERT = 0x150a;
  402 + public static final int GL_OR_REVERSE = 0x150b;
  403 + public static final int GL_COPY_INVERTED = 0x150c;
  404 + public static final int GL_OR_INVERTED = 0x150d;
  405 + public static final int GL_NAND = 0x150e;
  406 + public static final int GL_SET = 0x150f;
  407 + public static final int GL_EMISSION = 0x1600;
  408 + public static final int GL_SHININESS = 0x1601;
  409 + public static final int GL_AMBIENT_AND_DIFFUSE = 0x1602;
  410 + public static final int GL_COLOR_INDEXES = 0x1603;
  411 + public static final int GL_MODELVIEW = 0x1700;
  412 + public static final int GL_PROJECTION = 0x1701;
  413 + public static final int GL_TEXTURE = 0x1702;
  414 + public static final int GL_COLOR = 0x1800;
  415 + public static final int GL_DEPTH = 0x1801;
  416 + public static final int GL_STENCIL = 0x1802;
  417 + public static final int GL_COLOR_INDEX = 0x1900;
  418 + public static final int GL_STENCIL_INDEX = 0x1901;
  419 + public static final int GL_DEPTH_COMPONENT = 0x1902;
  420 + public static final int GL_RED = 0x1903;
  421 + public static final int GL_GREEN = 0x1904;
  422 + public static final int GL_BLUE = 0x1905;
  423 + public static final int GL_ALPHA = 0x1906;
  424 + public static final int GL_RGB = 0x1907;
  425 + public static final int GL_RGBA = 0x1908;
  426 + public static final int GL_LUMINANCE = 0x1909;
  427 + public static final int GL_LUMINANCE_ALPHA = 0x190a;
  428 + public static final int GL_BITMAP = 0x1a00;
  429 + public static final int GL_POINT = 0x1b00;
  430 + public static final int GL_LINE = 0x1b01;
  431 + public static final int GL_FILL = 0x1b02;
  432 + public static final int GL_RENDER = 0x1c00;
  433 + public static final int GL_FEEDBACK = 0x1c01;
  434 + public static final int GL_SELECT = 0x1c02;
  435 + public static final int GL_FLAT = 0x1d00;
  436 + public static final int GL_SMOOTH = 0x1d01;
  437 + public static final int GL_KEEP = 0x1e00;
  438 + public static final int GL_REPLACE = 0x1e01;
  439 + public static final int GL_INCR = 0x1e02;
  440 + public static final int GL_DECR = 0x1e03;
  441 + public static final int GL_VENDOR = 0x1f00;
  442 + public static final int GL_RENDERER = 0x1f01;
  443 + public static final int GL_VERSION = 0x1f02;
  444 + public static final int GL_EXTENSIONS = 0x1f03;
  445 + public static final int GL_S = 0x2000;
  446 + public static final int GL_T = 0x2001;
  447 + public static final int GL_R = 0x2002;
  448 + public static final int GL_Q = 0x2003;
  449 + public static final int GL_MODULATE = 0x2100;
  450 + public static final int GL_DECAL = 0x2101;
  451 + public static final int GL_TEXTURE_ENV_MODE = 0x2200;
  452 + public static final int GL_TEXTURE_ENV_COLOR = 0x2201;
  453 + public static final int GL_TEXTURE_ENV = 0x2300;
  454 + public static final int GL_EYE_LINEAR = 0x2400;
  455 + public static final int GL_OBJECT_LINEAR = 0x2401;
  456 + public static final int GL_SPHERE_MAP = 0x2402;
  457 + public static final int GL_TEXTURE_GEN_MODE = 0x2500;
  458 + public static final int GL_OBJECT_PLANE = 0x2501;
  459 + public static final int GL_EYE_PLANE = 0x2502;
  460 + public static final int GL_NEAREST = 0x2600;
  461 + public static final int GL_LINEAR = 0x2601;
  462 + public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
  463 + public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
  464 + public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
  465 + public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
  466 + public static final int GL_TEXTURE_MAG_FILTER = 0x2800;
  467 + public static final int GL_TEXTURE_MIN_FILTER = 0x2801;
  468 + public static final int GL_TEXTURE_WRAP_S = 0x2802;
  469 + public static final int GL_TEXTURE_WRAP_T = 0x2803;
  470 + public static final int GL_CLAMP = 0x2900;
  471 + public static final int GL_REPEAT = 0x2901;
  472 + public static final int GL_CLIENT_PIXEL_STORE_BIT = 0x1;
  473 + public static final int GL_CLIENT_VERTEX_ARRAY_BIT = 0x2;
  474 + public static final int GL_ALL_CLIENT_ATTRIB_BITS = 0xffffffff;
  475 + public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038;
  476 + public static final int GL_POLYGON_OFFSET_UNITS = 0x2a00;
  477 + public static final int GL_POLYGON_OFFSET_POINT = 0x2a01;
  478 + public static final int GL_POLYGON_OFFSET_LINE = 0x2a02;
  479 + public static final int GL_POLYGON_OFFSET_FILL = 0x8037;
  480 + public static final int GL_ALPHA4 = 0x803b;
  481 + public static final int GL_ALPHA8 = 0x803c;
  482 + public static final int GL_ALPHA12 = 0x803d;
  483 + public static final int GL_ALPHA16 = 0x803e;
  484 + public static final int GL_LUMINANCE4 = 0x803f;
  485 + public static final int GL_LUMINANCE8 = 0x8040;
  486 + public static final int GL_LUMINANCE12 = 0x8041;
  487 + public static final int GL_LUMINANCE16 = 0x8042;
  488 + public static final int GL_LUMINANCE4_ALPHA4 = 0x8043;
  489 + public static final int GL_LUMINANCE6_ALPHA2 = 0x8044;
  490 + public static final int GL_LUMINANCE8_ALPHA8 = 0x8045;
  491 + public static final int GL_LUMINANCE12_ALPHA4 = 0x8046;
  492 + public static final int GL_LUMINANCE12_ALPHA12 = 0x8047;
  493 + public static final int GL_LUMINANCE16_ALPHA16 = 0x8048;
  494 + public static final int GL_INTENSITY = 0x8049;
  495 + public static final int GL_INTENSITY4 = 0x804a;
  496 + public static final int GL_INTENSITY8 = 0x804b;
  497 + public static final int GL_INTENSITY12 = 0x804c;
  498 + public static final int GL_INTENSITY16 = 0x804d;
  499 + public static final int GL_R3_G3_B2 = 0x2a10;
  500 + public static final int GL_RGB4 = 0x804f;
  501 + public static final int GL_RGB5 = 0x8050;
  502 + public static final int GL_RGB8 = 0x8051;
  503 + public static final int GL_RGB10 = 0x8052;
  504 + public static final int GL_RGB12 = 0x8053;
  505 + public static final int GL_RGB16 = 0x8054;
  506 + public static final int GL_RGBA2 = 0x8055;
  507 + public static final int GL_RGBA4 = 0x8056;
  508 + public static final int GL_RGB5_A1 = 0x8057;
  509 + public static final int GL_RGBA8 = 0x8058;
  510 + public static final int GL_RGB10_A2 = 0x8059;
  511 + public static final int GL_RGBA12 = 0x805a;
  512 + public static final int GL_RGBA16 = 0x805b;
  513 + public static final int GL_TEXTURE_RED_SIZE = 0x805c;
  514 + public static final int GL_TEXTURE_GREEN_SIZE = 0x805d;
  515 + public static final int GL_TEXTURE_BLUE_SIZE = 0x805e;
  516 + public static final int GL_TEXTURE_ALPHA_SIZE = 0x805f;
  517 + public static final int GL_TEXTURE_LUMINANCE_SIZE = 0x8060;
  518 + public static final int GL_TEXTURE_INTENSITY_SIZE = 0x8061;
  519 + public static final int GL_PROXY_TEXTURE_1D = 0x8063;
  520 + public static final int GL_PROXY_TEXTURE_2D = 0x8064;
  521 + public static final int GL_TEXTURE_PRIORITY = 0x8066;
  522 + public static final int GL_TEXTURE_RESIDENT = 0x8067;
  523 + public static final int GL_TEXTURE_BINDING_1D = 0x8068;
  524 + public static final int GL_TEXTURE_BINDING_2D = 0x8069;
  525 + public static final int GL_VERTEX_ARRAY = 0x8074;
  526 + public static final int GL_NORMAL_ARRAY = 0x8075;
  527 + public static final int GL_COLOR_ARRAY = 0x8076;
  528 + public static final int GL_INDEX_ARRAY = 0x8077;
  529 + public static final int GL_TEXTURE_COORD_ARRAY = 0x8078;
  530 + public static final int GL_EDGE_FLAG_ARRAY = 0x8079;
  531 + public static final int GL_VERTEX_ARRAY_SIZE = 0x807a;
  532 + public static final int GL_VERTEX_ARRAY_TYPE = 0x807b;
  533 + public static final int GL_VERTEX_ARRAY_STRIDE = 0x807c;
  534 + public static final int GL_NORMAL_ARRAY_TYPE = 0x807e;
  535 + public static final int GL_NORMAL_ARRAY_STRIDE = 0x807f;
  536 + public static final int GL_COLOR_ARRAY_SIZE = 0x8081;
  537 + public static final int GL_COLOR_ARRAY_TYPE = 0x8082;
  538 + public static final int GL_COLOR_ARRAY_STRIDE = 0x8083;
  539 + public static final int GL_INDEX_ARRAY_TYPE = 0x8085;
  540 + public static final int GL_INDEX_ARRAY_STRIDE = 0x8086;
  541 + public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088;
  542 + public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089;
  543 + public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808a;
  544 + public static final int GL_EDGE_FLAG_ARRAY_STRIDE = 0x808c;
  545 + public static final int GL_VERTEX_ARRAY_POINTER = 0x808e;
  546 + public static final int GL_NORMAL_ARRAY_POINTER = 0x808f;
  547 + public static final int GL_COLOR_ARRAY_POINTER = 0x8090;
  548 + public static final int GL_INDEX_ARRAY_POINTER = 0x8091;
  549 + public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092;
  550 + public static final int GL_EDGE_FLAG_ARRAY_POINTER = 0x8093;
  551 + public static final int GL_V2F = 0x2a20;
  552 + public static final int GL_V3F = 0x2a21;
  553 + public static final int GL_C4UB_V2F = 0x2a22;
  554 + public static final int GL_C4UB_V3F = 0x2a23;
  555 + public static final int GL_C3F_V3F = 0x2a24;
  556 + public static final int GL_N3F_V3F = 0x2a25;
  557 + public static final int GL_C4F_N3F_V3F = 0x2a26;
  558 + public static final int GL_T2F_V3F = 0x2a27;
  559 + public static final int GL_T4F_V4F = 0x2a28;
  560 + public static final int GL_T2F_C4UB_V3F = 0x2a29;
  561 + public static final int GL_T2F_C3F_V3F = 0x2a2a;
  562 + public static final int GL_T2F_N3F_V3F = 0x2a2b;
  563 + public static final int GL_T2F_C4F_N3F_V3F = 0x2a2c;
  564 + public static final int GL_T4F_C4F_N3F_V4F = 0x2a2d;
  565 + public static final int GL_LOGIC_OP = 0xbf1;
  566 + public static final int GL_TEXTURE_COMPONENTS = 0x1003;
  567 +
  568 + // GL12
  569 + public static final int GL_TEXTURE_BINDING_3D = 0x806a;
  570 + public static final int GL_PACK_SKIP_IMAGES = 0x806b;
  571 + public static final int GL_PACK_IMAGE_HEIGHT = 0x806c;
  572 + public static final int GL_UNPACK_SKIP_IMAGES = 0x806d;
  573 + public static final int GL_UNPACK_IMAGE_HEIGHT = 0x806e;
  574 + public static final int GL_TEXTURE_3D = 0x806f;
  575 + public static final int GL_PROXY_TEXTURE_3D = 0x8070;
  576 + public static final int GL_TEXTURE_DEPTH = 0x8071;
  577 + public static final int GL_TEXTURE_WRAP_R = 0x8072;
  578 + public static final int GL_MAX_3D_TEXTURE_SIZE = 0x8073;
  579 + public static final int GL_BGR = 0x80e0;
  580 + public static final int GL_BGRA = 0x80e1;
  581 + public static final int GL_UNSIGNED_BYTE_3_3_2 = 0x8032;
  582 + public static final int GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362;
  583 + public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
  584 + public static final int GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364;
  585 + public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
  586 + public static final int GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365;
  587 + public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
  588 + public static final int GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366;
  589 + public static final int GL_UNSIGNED_INT_8_8_8_8 = 0x8035;
  590 + public static final int GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367;
  591 + public static final int GL_UNSIGNED_INT_10_10_10_2 = 0x8036;
  592 + public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368;
  593 + public static final int GL_RESCALE_NORMAL = 0x803a;
  594 + public static final int GL_LIGHT_MODEL_COLOR_CONTROL = 0x81f8;
  595 + public static final int GL_SINGLE_COLOR = 0x81f9;
  596 + public static final int GL_SEPARATE_SPECULAR_COLOR = 0x81fa;
  597 + public static final int GL_CLAMP_TO_EDGE = 0x812f;
  598 + public static final int GL_TEXTURE_MIN_LOD = 0x813a;
  599 + public static final int GL_TEXTURE_MAX_LOD = 0x813b;
  600 + public static final int GL_TEXTURE_BASE_LEVEL = 0x813c;
  601 + public static final int GL_TEXTURE_MAX_LEVEL = 0x813d;
  602 + public static final int GL_MAX_ELEMENTS_VERTICES = 0x80e8;
  603 + public static final int GL_MAX_ELEMENTS_INDICES = 0x80e9;
  604 + public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846d;
  605 + public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846e;
  606 + public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0xb12;
  607 + public static final int GL_SMOOTH_POINT_SIZE_GRANULARITY = 0xb13;
  608 + public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 0xb22;
  609 + public static final int GL_SMOOTH_LINE_WIDTH_GRANULARITY = 0xb23;
  610 +
  611 + // GL13
  612 + public static final int GL_TEXTURE0 = 0x84c0;
  613 + public static final int GL_TEXTURE1 = 0x84c1;
  614 + public static final int GL_TEXTURE2 = 0x84c2;
  615 + public static final int GL_TEXTURE3 = 0x84c3;
  616 + public static final int GL_TEXTURE4 = 0x84c4;
  617 + public static final int GL_TEXTURE5 = 0x84c5;
  618 + public static final int GL_TEXTURE6 = 0x84c6;
  619 + public static final int GL_TEXTURE7 = 0x84c7;
  620 + public static final int GL_TEXTURE8 = 0x84c8;
  621 + public static final int GL_TEXTURE9 = 0x84c9;
  622 + public static final int GL_TEXTURE10 = 0x84ca;
  623 + public static final int GL_TEXTURE11 = 0x84cb;
  624 + public static final int GL_TEXTURE12 = 0x84cc;
  625 + public static final int GL_TEXTURE13 = 0x84cd;
  626 + public static final int GL_TEXTURE14 = 0x84ce;
  627 + public static final int GL_TEXTURE15 = 0x84cf;
  628 + public static final int GL_TEXTURE16 = 0x84d0;
  629 + public static final int GL_TEXTURE17 = 0x84d1;
  630 + public static final int GL_TEXTURE18 = 0x84d2;
  631 + public static final int GL_TEXTURE19 = 0x84d3;
  632 + public static final int GL_TEXTURE20 = 0x84d4;
  633 + public static final int GL_TEXTURE21 = 0x84d5;
  634 + public static final int GL_TEXTURE22 = 0x84d6;
  635 + public static final int GL_TEXTURE23 = 0x84d7;
  636 + public static final int GL_TEXTURE24 = 0x84d8;
  637 + public static final int GL_TEXTURE25 = 0x84d9;
  638 + public static final int GL_TEXTURE26 = 0x84da;
  639 + public static final int GL_TEXTURE27 = 0x84db;
  640 + public static final int GL_TEXTURE28 = 0x84dc;
  641 + public static final int GL_TEXTURE29 = 0x84dd;
  642 + public static final int GL_TEXTURE30 = 0x84de;
  643 + public static final int GL_TEXTURE31 = 0x84df;
  644 + public static final int GL_ACTIVE_TEXTURE = 0x84e0;
  645 + public static final int GL_CLIENT_ACTIVE_TEXTURE = 0x84e1;
  646 + public static final int GL_MAX_TEXTURE_UNITS = 0x84e2;
  647 + public static final int GL_NORMAL_MAP = 0x8511;
  648 + public static final int GL_REFLECTION_MAP = 0x8512;
  649 + public static final int GL_TEXTURE_CUBE_MAP = 0x8513;
  650 + public static final int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514;
  651 + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
  652 + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
  653 + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
  654 + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
  655 + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
  656 + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a;
  657 + public static final int GL_PROXY_TEXTURE_CUBE_MAP = 0x851b;
  658 + public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851c;
  659 + public static final int GL_COMPRESSED_ALPHA = 0x84e9;
  660 + public static final int GL_COMPRESSED_LUMINANCE = 0x84ea;
  661 + public static final int GL_COMPRESSED_LUMINANCE_ALPHA = 0x84eb;
  662 + public static final int GL_COMPRESSED_INTENSITY = 0x84ec;
  663 + public static final int GL_COMPRESSED_RGB = 0x84ed;
  664 + public static final int GL_COMPRESSED_RGBA = 0x84ee;
  665 + public static final int GL_TEXTURE_COMPRESSION_HINT = 0x84ef;
  666 + public static final int GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86a0;
  667 + public static final int GL_TEXTURE_COMPRESSED = 0x86a1;
  668 + public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86a2;
  669 + public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86a3;
  670 + public static final int GL_MULTISAMPLE = 0x809d;
  671 + public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809e;
  672 + public static final int GL_SAMPLE_ALPHA_TO_ONE = 0x809f;
  673 + public static final int GL_SAMPLE_COVERAGE = 0x80a0;
  674 + public static final int GL_SAMPLE_BUFFERS = 0x80a8;
  675 + public static final int GL_SAMPLES = 0x80a9;
  676 + public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80aa;
  677 + public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80ab;
  678 + public static final int GL_MULTISAMPLE_BIT = 0x20000000;
  679 + public static final int GL_TRANSPOSE_MODELVIEW_MATRIX = 0x84e3;
  680 + public static final int GL_TRANSPOSE_PROJECTION_MATRIX = 0x84e4;
  681 + public static final int GL_TRANSPOSE_TEXTURE_MATRIX = 0x84e5;
  682 + public static final int GL_TRANSPOSE_COLOR_MATRIX = 0x84e6;
  683 + public static final int GL_COMBINE = 0x8570;
  684 + public static final int GL_COMBINE_RGB = 0x8571;
  685 + public static final int GL_COMBINE_ALPHA = 0x8572;
  686 + public static final int GL_SOURCE0_RGB = 0x8580;
  687 + public static final int GL_SOURCE1_RGB = 0x8581;
  688 + public static final int GL_SOURCE2_RGB = 0x8582;
  689 + public static final int GL_SOURCE0_ALPHA = 0x8588;
  690 + public static final int GL_SOURCE1_ALPHA = 0x8589;
  691 + public static final int GL_SOURCE2_ALPHA = 0x858a;
  692 + public static final int GL_OPERAND0_RGB = 0x8590;
  693 + public static final int GL_OPERAND1_RGB = 0x8591;
  694 + public static final int GL_OPERAND2_RGB = 0x8592;
  695 + public static final int GL_OPERAND0_ALPHA = 0x8598;
  696 + public static final int GL_OPERAND1_ALPHA = 0x8599;
  697 + public static final int GL_OPERAND2_ALPHA = 0x859a;
  698 + public static final int GL_RGB_SCALE = 0x8573;
  699 + public static final int GL_ADD_SIGNED = 0x8574;
  700 + public static final int GL_INTERPOLATE = 0x8575;
  701 + public static final int GL_SUBTRACT = 0x84e7;
  702 + public static final int GL_CONSTANT = 0x8576;
  703 + public static final int GL_PRIMARY_COLOR = 0x8577;
  704 + public static final int GL_PREVIOUS = 0x8578;
  705 + public static final int GL_DOT3_RGB = 0x86ae;
  706 + public static final int GL_DOT3_RGBA = 0x86af;
  707 + public static final int GL_CLAMP_TO_BORDER = 0x812d;
  708 +
  709 + // GL14
  710 + public static final int GL_GENERATE_MIPMAP = 0x8191;
  711 + public static final int GL_GENERATE_MIPMAP_HINT = 0x8192;
  712 + public static final int GL_DEPTH_COMPONENT16 = 0x81a5;
  713 + public static final int GL_DEPTH_COMPONENT24 = 0x81a6;
  714 + public static final int GL_DEPTH_COMPONENT32 = 0x81a7;
  715 + public static final int GL_TEXTURE_DEPTH_SIZE = 0x884a;
  716 + public static final int GL_DEPTH_TEXTURE_MODE = 0x884b;
  717 + public static final int GL_TEXTURE_COMPARE_MODE = 0x884c;
  718 + public static final int GL_TEXTURE_COMPARE_FUNC = 0x884d;
  719 + public static final int GL_COMPARE_R_TO_TEXTURE = 0x884e;
  720 + public static final int GL_FOG_COORDINATE_SOURCE = 0x8450;
  721 + public static final int GL_FOG_COORDINATE = 0x8451;
  722 + public static final int GL_FRAGMENT_DEPTH = 0x8452;
  723 + public static final int GL_CURRENT_FOG_COORDINATE = 0x8453;
  724 + public static final int GL_FOG_COORDINATE_ARRAY_TYPE = 0x8454;
  725 + public static final int GL_FOG_COORDINATE_ARRAY_STRIDE = 0x8455;
  726 + public static final int GL_FOG_COORDINATE_ARRAY_POINTER = 0x8456;
  727 + public static final int GL_FOG_COORDINATE_ARRAY = 0x8457;
  728 + public static final int GL_POINT_SIZE_MIN = 0x8126;
  729 + public static final int GL_POINT_SIZE_MAX = 0x8127;
  730 + public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128;
  731 + public static final int GL_POINT_DISTANCE_ATTENUATION = 0x8129;
  732 + public static final int GL_COLOR_SUM = 0x8458;
  733 + public static final int GL_CURRENT_SECONDARY_COLOR = 0x8459;
  734 + public static final int GL_SECONDARY_COLOR_ARRAY_SIZE = 0x845a;
  735 + public static final int GL_SECONDARY_COLOR_ARRAY_TYPE = 0x845b;
  736 + public static final int GL_SECONDARY_COLOR_ARRAY_STRIDE = 0x845c;
  737 + public static final int GL_SECONDARY_COLOR_ARRAY_POINTER = 0x845d;
  738 + public static final int GL_SECONDARY_COLOR_ARRAY = 0x845e;
  739 + public static final int GL_BLEND_DST_RGB = 0x80c8;
  740 + public static final int GL_BLEND_SRC_RGB = 0x80c9;
  741 + public static final int GL_BLEND_DST_ALPHA = 0x80ca;
  742 + public static final int GL_BLEND_SRC_ALPHA = 0x80cb;
  743 + public static final int GL_INCR_WRAP = 0x8507;
  744 + public static final int GL_DECR_WRAP = 0x8508;
  745 + public static final int GL_TEXTURE_FILTER_CONTROL = 0x8500;
  746 + public static final int GL_TEXTURE_LOD_BIAS = 0x8501;
  747 + public static final int GL_MAX_TEXTURE_LOD_BIAS = 0x84fd;
  748 + public static final int GL_MIRRORED_REPEAT = 0x8370;
  749 + public static final int GL_BLEND_COLOR = 0x8005;
  750 + public static final int GL_BLEND_EQUATION = 0x8009;
  751 + public static final int GL_FUNC_ADD = 0x8006;
  752 + public static final int GL_FUNC_SUBTRACT = 0x800a;
  753 + public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800b;
  754 + public static final int GL_MIN = 0x8007;
  755 + public static final int GL_MAX = 0x8008;
  756 +
  757 + // GL15
  758 + public static final int GL_ARRAY_BUFFER = 0x8892;
  759 + public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
  760 + public static final int GL_ARRAY_BUFFER_BINDING = 0x8894;
  761 + public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
  762 + public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 0x8896;
  763 + public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 0x8897;
  764 + public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 0x8898;
  765 + public static final int GL_INDEX_ARRAY_BUFFER_BINDING = 0x8899;
  766 + public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889a;
  767 + public static final int GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889b;
  768 + public static final int GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889c;
  769 + public static final int GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889d;
  770 + public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING = 0x889e;
  771 + public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889f;
  772 + public static final int GL_STREAM_DRAW = 0x88e0;
  773 + public static final int GL_STREAM_READ = 0x88e1;
  774 + public static final int GL_STREAM_COPY = 0x88e2;
  775 + public static final int GL_STATIC_DRAW = 0x88e4;
  776 + public static final int GL_STATIC_READ = 0x88e5;
  777 + public static final int GL_STATIC_COPY = 0x88e6;
  778 + public static final int GL_DYNAMIC_DRAW = 0x88e8;
  779 + public static final int GL_DYNAMIC_READ = 0x88e9;
  780 + public static final int GL_DYNAMIC_COPY = 0x88ea;
  781 + public static final int GL_READ_ONLY = 0x88b8;
  782 + public static final int GL_WRITE_ONLY = 0x88b9;
  783 + public static final int GL_READ_WRITE = 0x88ba;
  784 + public static final int GL_BUFFER_SIZE = 0x8764;
  785 + public static final int GL_BUFFER_USAGE = 0x8765;
  786 + public static final int GL_BUFFER_ACCESS = 0x88bb;
  787 + public static final int GL_BUFFER_MAPPED = 0x88bc;
  788 + public static final int GL_BUFFER_MAP_POINTER = 0x88bd;
  789 + public static final int FOG_COORD_SRC = 0x8450;
  790 + public static final int GL_FOG_COORD = 0x8451;
  791 + public static final int GL_CURRENT_FOG_COORD = 0x8453;
  792 + public static final int GL_FOG_COORD_ARRAY_TYPE = 0x8454;
  793 + public static final int GL_FOG_COORD_ARRAY_STRIDE = 0x8455;
  794 + public static final int GL_FOG_COORD_ARRAY_POINTER = 0x8456;
  795 + public static final int GL_FOG_COORD_ARRAY = 0x8457;
  796 + public static final int GL_FOG_COORD_ARRAY_BUFFER_BINDING = 0x889d;
  797 + public static final int GL_SRC0_RGB = 0x8580;
  798 + public static final int GL_SRC1_RGB = 0x8581;
  799 + public static final int GL_SRC2_RGB = 0x8582;
  800 + public static final int GL_SRC0_ALPHA = 0x8588;
  801 + public static final int GL_SRC1_ALPHA = 0x8589;
  802 + public static final int GL_SRC2_ALPHA = 0x858a;
  803 +
  804 + public static void glPushAttrib()
  805 + {
  806 + GlStateManager.pushAttrib();
  807 + }
  808 +
  809 + public static void glPopAttrib()
  810 + {
  811 + GlStateManager.popAttrib();
  812 + }
  813 +
  814 + public static void glDisableAlpha()
  815 + {
  816 + GlStateManager.disableAlpha();
  817 + }
  818 +
  819 + public static void glEnableAlpha()
  820 + {
  821 + GlStateManager.enableAlpha();
  822 + }
  823 +
  824 + public static void glAlphaFunc(int func, float ref)
  825 + {
  826 + GlStateManager.alphaFunc(func, ref);
  827 + }
  828 +
  829 + public static void glEnableLighting()
  830 + {
  831 + GlStateManager.enableLighting();
  832 + }
  833 +
  834 + public static void glDisableLighting()
  835 + {
  836 + GlStateManager.disableLighting();
  837 + }
  838 +
  839 + public static void glEnableLight(int light)
  840 + {
  841 + GlStateManager.enableLight(light); // TODO OBF MCPTEST enableBooleanStateAt - enableLight
  842 + }
  843 +
  844 + public static void glDisableLight(int light)
  845 + {
  846 + GlStateManager.disableLight(light); // TODO OBF MCPTEST disableBooleanStateAt - disableLight
  847 + }
  848 +
  849 + public static void glEnableColorMaterial()
  850 + {
  851 + GlStateManager.enableColorMaterial();
  852 + }
  853 +
  854 + public static void glDisableColorMaterial()
  855 + {
  856 + GlStateManager.disableColorMaterial();
  857 + }
  858 +
  859 + public static void glColorMaterial(int face, int mode)
  860 + {
  861 + GlStateManager.colorMaterial(face, mode);
  862 + }
  863 +
  864 + public static void glDisableDepth()
  865 + {
  866 + GlStateManager.disableDepth();
  867 + }
  868 +
  869 + public static void glEnableDepth()
  870 + {
  871 + GlStateManager.enableDepth();
  872 + }
  873 +
  874 + public static void glDepthFunc(int func)
  875 + {
  876 + GlStateManager.depthFunc(func);
  877 + }
  878 +
  879 + public static void glDepthMask(boolean flag)
  880 + {
  881 + GlStateManager.depthMask(flag);
  882 + }
  883 +
  884 + public static void glDisableBlend()
  885 + {
  886 + GlStateManager.disableBlend();
  887 + }
  888 +
  889 + public static void glEnableBlend()
  890 + {
  891 + GlStateManager.enableBlend();
  892 + }
  893 +
  894 + public static void glBlendFunc(int sfactor, int dfactor)
  895 + {
  896 + GlStateManager.blendFunc(sfactor, dfactor);
  897 + }
  898 +
  899 + public static void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha)
  900 + {
  901 + GlStateManager.tryBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
  902 + }
  903 +
  904 + public static void glEnableFog()
  905 + {
  906 + GlStateManager.enableFog();
  907 + }
  908 +
  909 + public static void glDisableFog()
  910 + {
  911 + GlStateManager.disableFog();
  912 + }
  913 +
  914 + public static void glSetFogMode(int mode)
  915 + {
  916 + GlStateManager.setFog(mode);
  917 + }
  918 +
  919 + public static void glSetFogDensity(float density)
  920 + {
  921 + GlStateManager.setFogDensity(density);
  922 + }
  923 +
  924 + public static void glSetFogStart(float start)
  925 + {
  926 + GlStateManager.setFogStart(start);
  927 + }
  928 +
  929 + public static void glSetFogEnd(float end)
  930 + {
  931 + GlStateManager.setFogEnd(end);
  932 + }
  933 +
  934 + public static void glEnableCulling()
  935 + {
  936 + GlStateManager.enableCull();
  937 + }
  938 +
  939 + public static void glDisableCulling()
  940 + {
  941 + GlStateManager.disableCull();
  942 + }
  943 +
  944 + public static void glCullFace(int mode)
  945 + {
  946 + GlStateManager.cullFace(mode);
  947 + }
  948 +
  949 + public static void glEnablePolygonOffset()
  950 + {
  951 + GlStateManager.enablePolygonOffset();
  952 + }
  953 +
  954 + public static void glDisablePolygonOffset()
  955 + {
  956 + GlStateManager.disablePolygonOffset();
  957 + }
  958 +
  959 + public static void glPolygonOffset(float factor, float units)
  960 + {
  961 + GlStateManager.doPolygonOffset(factor, units);
  962 + }
  963 +
  964 + public static void glEnableColorLogic()
  965 + {
  966 + GlStateManager.enableColorLogic();
  967 + }
  968 +
  969 + public static void glDisableColorLogic()
  970 + {
  971 + GlStateManager.disableColorLogic();
  972 + }
  973 +
  974 + public static void glColorLogicOp(int opcode)
  975 + {
  976 + GlStateManager.colorLogicOp(opcode);
  977 + }
  978 +
  979 + public static void glEnableTexGenCoord(TexGen tex)
  980 + {
  981 + GlStateManager.enableTexGenCoord(tex);
  982 + }
  983 +
  984 + public static void glDisableTexGenCoord(TexGen tex)
  985 + {
  986 + GlStateManager.disableTexGenCoord(tex);
  987 + }
  988 +
  989 + public static void glTexGeni(TexGen tex, int mode)
  990 + {
  991 + GlStateManager.texGen(tex, mode);
  992 + }
  993 +
  994 + public static void glTexGen(TexGen tex, int pname, FloatBuffer params)
  995 + {
  996 + GlStateManager.func_179105_a(tex, pname, params);
  997 + }
  998 +
  999 + public static void glSetActiveTextureUnit(int texture)
  1000 + {
  1001 + GlStateManager.setActiveTexture(texture);
  1002 + }
  1003 +
  1004 + public static void glEnableTexture2D()
  1005 + {
  1006 + GlStateManager.enableTexture2D(); // TODO OBF MCPTEST func_179098_w - enableTexture2D
  1007 + }
  1008 +
  1009 + public static void glDisableTexture2D()
  1010 + {
  1011 + GlStateManager.disableTexture2D(); // TODO OBF MCPTEST func_179090_x - disableTexture2D
  1012 + }
  1013 +
  1014 + public static int glGenTextures()
  1015 + {
  1016 + return GlStateManager.generateTexture(); // TODO OBF MCPTEST func_179146_y - generateTexture
  1017 + }
  1018 +
  1019 + public static void glDeleteTexture(int textureName)
  1020 + {
  1021 + GlStateManager.deleteTexture(textureName); // TODO OBF MCPTEST func_179150_h - deleteTexture
  1022 + }
  1023 +
  1024 + public static void glBindTexture(int textureName)
  1025 + {
  1026 + GlStateManager.bindTexture(textureName); // TODO OBF MCPTEST func_179144_i - bindTexture
  1027 + }
  1028 +
  1029 + public static void glEnableNormalize()
  1030 + {
  1031 + GlStateManager.enableNormalize();
  1032 + }
  1033 +
  1034 + public static void glDisableNormalize()
  1035 + {
  1036 + GlStateManager.disableNormalize();
  1037 + }
  1038 +
  1039 + public static void glShadeModel(int mode)
  1040 + {
  1041 + GlStateManager.shadeModel(mode);
  1042 + }
  1043 +
  1044 + public static void glEnableRescaleNormal()
  1045 + {
  1046 + GlStateManager.enableRescaleNormal();
  1047 + }
  1048 +
  1049 + public static void glDisableRescaleNormal()
  1050 + {
  1051 + GlStateManager.disableRescaleNormal();
  1052 + }
  1053 +
  1054 + public static void glViewport(int x, int y, int width, int height)
  1055 + {
  1056 + GlStateManager.viewport(x, y, width, height);
  1057 + }
  1058 +
  1059 + public static void glColorMask(boolean red, boolean green, boolean blue, boolean alpha)
  1060 + {
  1061 + GlStateManager.colorMask(red, green, blue, alpha);
  1062 + }
  1063 +
  1064 + public static void glClearDepth(double depth)
  1065 + {
  1066 + GlStateManager.clearDepth(depth);
  1067 + }
  1068 +
  1069 + public static void glClearColor(float red, float green, float blue, float alpha)
  1070 + {
  1071 + GlStateManager.clearColor(red, green, blue, alpha);
  1072 + }
  1073 +
  1074 + public static void glClear(int mask)
  1075 + {
  1076 + GlStateManager.clear(mask);
  1077 + }
  1078 +
  1079 + public static void glMatrixMode(int mode)
  1080 + {
  1081 + GlStateManager.matrixMode(mode);
  1082 + }
  1083 +
  1084 + public static void glLoadIdentity()
  1085 + {
  1086 + GlStateManager.loadIdentity();
  1087 + }
  1088 +
  1089 + public static void glPushMatrix()
  1090 + {
  1091 + GlStateManager.pushMatrix();
  1092 + }
  1093 +
  1094 + public static void glPopMatrix()
  1095 + {
  1096 + GlStateManager.popMatrix();
  1097 + }
  1098 +
  1099 + public static void glGetFloat(int pname, FloatBuffer params)
  1100 + {
  1101 + GlStateManager.getFloat(pname, params);
  1102 + }
  1103 +
  1104 + public static void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
  1105 + {
  1106 + GlStateManager.ortho(left, right, bottom, top, zNear, zFar);
  1107 + }
  1108 +
  1109 + public static void glRotatef(float angle, float x, float y, float z)
  1110 + {
  1111 + GlStateManager.rotate(angle, x, y, z);
  1112 + }
  1113 +
  1114 + public static void glScalef(float x, float y, float z)
  1115 + {
  1116 + GlStateManager.scale(x, y, z);
  1117 + }
  1118 +
  1119 + public static void glScaled(double x, double y, double z)
  1120 + {
  1121 + GlStateManager.scale(x, y, z);
  1122 + }
  1123 +
  1124 + public static void glTranslatef(float x, float y, float z)
  1125 + {
  1126 + GlStateManager.translate(x, y, z);
  1127 + }
  1128 +
  1129 + public static void glTranslated(double x, double y, double z)
  1130 + {
  1131 + GlStateManager.translate(x, y, z);
  1132 + }
  1133 +
  1134 + public static void glMultMatrix(FloatBuffer m)
  1135 + {
  1136 + GlStateManager.multMatrix(m);
  1137 + }
  1138 +
  1139 + public static void glColor4f(float red, float green, float blue, float alpha)
  1140 + {
  1141 + GlStateManager.color(red, green, blue, alpha);
  1142 + }
  1143 +
  1144 + public static void glColor3f(float red, float green, float blue)
  1145 + {
  1146 + GlStateManager.color(red, green, blue, 1.0F);
  1147 + }
  1148 +
  1149 + public static void glResetColor()
  1150 + {
  1151 + GlStateManager.func_179117_G();
  1152 + }
  1153 +
  1154 + public static void glCallList(int list)
  1155 + {
  1156 + GlStateManager.callList(list);
  1157 + }
  1158 +}
... ...
java/client/com/mumfrey/liteloader/client/util/PrivateFields.java
... ... @@ -139,7 +139,7 @@ public class PrivateFields&lt;P, T&gt;
139 139 }
140 140  
141 141 public static final PrivateFields<RenderManager, Map> entityRenderMap = new PrivateFields<RenderManager, Map> (RenderManager.class, Obf.entityRenderMap);
142   - public static final PrivateFields<NetHandlerLoginClient, NetworkManager> netManager = new PrivateFields<NetHandlerLoginClient, NetworkManager> (NetHandlerLoginClient.class, Obf.netManager);
  142 + public static final PrivateFields<NetHandlerLoginClient, NetworkManager> netManager = new PrivateFields<NetHandlerLoginClient, NetworkManager> (NetHandlerLoginClient.class, Obf.networkManager);
143 143 public static final PrivateFields<RegistrySimple, Map> registryObjects = new PrivateFields<RegistrySimple, Map> (RegistrySimple.class, Obf.registryObjects);
144 144 public static final PrivateFields<RegistryNamespaced, ObjectIntIdentityMap> underlyingIntegerMap = new PrivateFields<RegistryNamespaced, ObjectIntIdentityMap>(RegistryNamespaced.class, Obf.underlyingIntegerMap);
145 145 public static final PrivateFields<ObjectIntIdentityMap, IdentityHashMap> identityMap = new PrivateFields<ObjectIntIdentityMap, IdentityHashMap> (ObjectIntIdentityMap.class, Obf.identityMap);
... ...
java/client/com/mumfrey/liteloader/client/util/render/Icon.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.util.render;
  2 +
  3 +public interface Icon
  4 +{
  5 + public abstract int getIconWidth();
  6 + public abstract int getIconHeight();
  7 + public abstract float getMinU();
  8 + public abstract float getMaxU();
  9 + public abstract float getInterpolatedU(double p_94214_1_);
  10 + public abstract float getMinV();
  11 + public abstract float getMaxV();
  12 + public abstract float getInterpolatedV(double p_94207_1_);
  13 + public abstract String getIconName();
  14 +}
... ...
java/client/com/mumfrey/liteloader/client/util/render/IconTiled.java
1 1 package com.mumfrey.liteloader.client.util.render;
2 2  
3   -import net.minecraft.util.IIcon;
4 3 import net.minecraft.util.ResourceLocation;
5 4  
6   -public class IconTiled implements IIcon
  5 +public class IconTiled implements Icon
7 6 {
8 7 private ResourceLocation textureResource;
9 8  
... ...
java/client/com/mumfrey/liteloader/util/ModUtilities.java
... ... @@ -24,6 +24,7 @@ import net.minecraft.tileentity.TileEntity;
24 24 import net.minecraft.util.ObjectIntIdentityMap;
25 25 import net.minecraft.util.RegistryNamespaced;
26 26 import net.minecraft.util.RegistrySimple;
  27 +import net.minecraft.util.ResourceLocation;
27 28  
28 29 import com.mumfrey.liteloader.client.util.PrivateFields;
29 30 import com.mumfrey.liteloader.core.LiteLoader;
... ... @@ -84,11 +85,12 @@ public abstract class ModUtilities
84 85 @SuppressWarnings("unchecked")
85 86 public static void addRenderer(Class<? extends Entity> entityClass, Render renderer)
86 87 {
87   - Map<Class<? extends Entity>, Render> entityRenderMap = PrivateFields.entityRenderMap.get(RenderManager.instance);
  88 + RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
  89 +
  90 + Map<Class<? extends Entity>, Render> entityRenderMap = PrivateFields.entityRenderMap.get(renderManager);
88 91 if (entityRenderMap != null)
89 92 {
90 93 entityRenderMap.put(entityClass, renderer);
91   - renderer.setRenderManager(RenderManager.instance);
92 94 }
93 95 else
94 96 {
... ... @@ -105,7 +107,7 @@ public abstract class ModUtilities
105 107 {
106 108 Map<Class<? extends TileEntity>, TileEntitySpecialRenderer> specialRendererMap = PrivateFields.specialRendererMap.get(tileEntityRenderer);
107 109 specialRendererMap.put(tileEntityClass, renderer);
108   - renderer.func_147497_a(tileEntityRenderer); // setDispatcher
  110 + renderer.setRendererDispatcher(tileEntityRenderer);
109 111 }
110 112 catch (Exception ex)
111 113 {
... ... @@ -121,20 +123,20 @@ public abstract class ModUtilities
121 123 * @param block Block to register
122 124 * @param force Force insertion even if the operation is blocked by FMl
123 125 */
124   - public static void addBlock(int blockId, String blockName, Block block, boolean force)
  126 + public static void addBlock(int blockId, ResourceLocation blockName, Block block, boolean force)
125 127 {
126   - Block existingBlock = Block.blockRegistry.getObject(blockName);
  128 + Block existingBlock = (Block)Block.blockRegistry.getObject(blockName);
127 129  
128 130 try
129 131 {
130   - Block.blockRegistry.addObject(blockId, blockName, block);
  132 + Block.blockRegistry.register(blockId, blockName, block);
131 133 }
132 134 catch (IllegalArgumentException ex)
133 135 {
134 136 if (!force) throw new IllegalArgumentException("Could not register block '" + blockName + "', the operation was blocked by FML.", ex);
135 137  
136 138 ModUtilities.removeObjectFromRegistry(Block.blockRegistry, blockName);
137   - Block.blockRegistry.addObject(blockId, blockName, block);
  139 + Block.blockRegistry.register(blockId, blockName, block);
138 140 }
139 141  
140 142 if (existingBlock != null)
... ... @@ -166,20 +168,20 @@ public abstract class ModUtilities
166 168 * @param item Item to register
167 169 * @param force Force insertion even if the operation is blocked by FMl
168 170 */
169   - public static void addItem(int itemId, String itemName, Item item, boolean force)
  171 + public static void addItem(int itemId, ResourceLocation itemName, Item item, boolean force)
170 172 {
171   - Item existingItem = Item.itemRegistry.getObject(itemName);
  173 + Item existingItem = (Item)Item.itemRegistry.getObject(itemName);
172 174  
173 175 try
174 176 {
175   - Item.itemRegistry.addObject(itemId, itemName, item);
  177 + Item.itemRegistry.register(itemId, itemName, item);
176 178 }
177 179 catch (IllegalArgumentException ex)
178 180 {
179 181 if (!force) throw new IllegalArgumentException("Could not register item '" + itemName + "', the operation was blocked by FML.", ex);
180 182  
181 183 ModUtilities.removeObjectFromRegistry(Block.blockRegistry, itemName);
182   - Item.itemRegistry.addObject(itemId, itemName, item);
  184 + Item.itemRegistry.register(itemId, itemName, item);
183 185 }
184 186  
185 187 if (existingItem != null)
... ... @@ -269,15 +271,15 @@ public abstract class ModUtilities
269 271 }
270 272  
271 273 @SuppressWarnings("unchecked")
272   - private static <K, V> V removeObjectFromRegistry(RegistrySimple<K, V> registry, K key)
  274 + private static <K, V> V removeObjectFromRegistry(RegistrySimple registry, K key)
273 275 {
274 276 if (registry == null) return null;
275 277  
276   - ObjectIntIdentityMap<V> underlyingIntegerMap = null;
  278 + ObjectIntIdentityMap underlyingIntegerMap = null;
277 279  
278 280 if (registry instanceof RegistryNamespaced)
279 281 {
280   - RegistryNamespaced<V> rns = (RegistryNamespaced<V>)registry;
  282 + RegistryNamespaced rns = (RegistryNamespaced)registry;
281 283 underlyingIntegerMap = PrivateFields.underlyingIntegerMap.get(rns);
282 284 }
283 285  
... ...
java/common/com/mumfrey/liteloader/PluginChannelListener.java
1 1 package com.mumfrey.liteloader;
2 2  
  3 +import net.minecraft.network.PacketBuffer;
  4 +
3 5 import com.mumfrey.liteloader.core.CommonPluginChannelListener;
4 6  
5 7 /**
... ... @@ -13,8 +15,7 @@ public interface PluginChannelListener extends CommonPluginChannelListener, Join
13 15 * Called when a custom payload packet arrives on a channel this mod has registered
14 16 *
15 17 * @param channel Channel on which the custom payload was received
16   - * @param length Length of the custom payload data
17 18 * @param data Custom payload data
18 19 */
19   - public abstract void onCustomPayload(String channel, int length, byte[] data);
  20 + public abstract void onCustomPayload(String channel, PacketBuffer data);
20 21 }
... ...
java/common/com/mumfrey/liteloader/PreJoinGameListener.java
... ... @@ -12,15 +12,12 @@ import net.minecraft.network.play.server.S01PacketJoinGame;
12 12 public interface PreJoinGameListener extends LiteMod
13 13 {
14 14 /**
15   - * Called on login
  15 + * Called before login. NOTICE: as of 1.8 the return value of this method has a different meaning!
16 16 *
17 17 * @param netHandler Net handler
18 18 * @param joinGamePacket Join game packet
19 19 *
20   - * @return true to cancel the event
21   - * @deprecated this event's return code is not compatible with other events expressing the same pattern,
22   - * it will be replaced in the next release with a method whose return value is boolean to NOT cancel
  20 + * @return true to allow login to continue, false to cancel login
23 21 */
24   - @Deprecated
25 22 public abstract boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket);
26 23 }
... ...
java/common/com/mumfrey/liteloader/ServerPluginChannelListener.java
1 1 package com.mumfrey.liteloader;
2 2  
3 3 import net.minecraft.entity.player.EntityPlayerMP;
  4 +import net.minecraft.network.PacketBuffer;
4 5  
5 6 import com.mumfrey.liteloader.core.CommonPluginChannelListener;
6 7  
... ... @@ -13,10 +14,10 @@ public interface ServerPluginChannelListener extends CommonPluginChannelListener
13 14 {
14 15 /**
15 16 * Called when a custom payload packet arrives on a channel this mod has registered
16   - *
  17 + *
  18 + * @param sender Player object which is the source of this message
17 19 * @param channel Channel on which the custom payload was received
18   - * @param length Length of the custom payload data
19 20 * @param data Custom payload data
20 21 */
21   - public abstract void onCustomPayload(EntityPlayerMP sender, String channel, int length, byte[] data);
  22 + public abstract void onCustomPayload(EntityPlayerMP sender, String channel, PacketBuffer data);
22 23 }
... ...
java/common/com/mumfrey/liteloader/api/BrandingProvider.java
... ... @@ -2,9 +2,10 @@ package com.mumfrey.liteloader.api;
2 2  
3 3 import java.net.URI;
4 4  
5   -import net.minecraft.util.IIcon;
6 5 import net.minecraft.util.ResourceLocation;
7 6  
  7 +import com.mumfrey.liteloader.client.util.render.Icon;
  8 +
8 9 /**
9 10 * LiteLoader Extensible API - Branding Provider
10 11 *
... ... @@ -50,7 +51,7 @@ public interface BrandingProvider extends CustomisationProvider
50 51 * Gets the coordinates of the logo as an IIcon instance, only called if getLogoResource() returns
51 52 * a non-null value and the logo will only be used if BOTH methods return a valid object.
52 53 */
53   - public abstract IIcon getLogoCoords();
  54 + public abstract Icon getLogoCoords();
54 55  
55 56 /**
56 57 * Get the resource to use for the icon logo (the chicken in the default setup), the API with the
... ... @@ -63,7 +64,7 @@ public interface BrandingProvider extends CustomisationProvider
63 64 * Gets the coordinates of the icon logo as an IIcon instance, only called if getIconResource()
64 65 * returns a non-null value and the icon will only be used if BOTH methods return a valid object.
65 66 */
66   - public abstract IIcon getIconCoords();
  67 + public abstract Icon getIconCoords();
67 68  
68 69 /**
69 70 * Get the display name for this API, used on the "about" screen, must not return null
... ... @@ -97,5 +98,5 @@ public interface BrandingProvider extends CustomisationProvider
97 98 * If you wish to display a clickable twitter icon next to the API information, return the icon
98 99 * coordinates here.
99 100 */
100   - public abstract IIcon getTwitterAvatarCoords();
  101 + public abstract Icon getTwitterAvatarCoords();
101 102 }
... ...
java/common/com/mumfrey/liteloader/api/EnumerationObserver.java 0 → 100644
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.io.File;
  4 +
  5 +import com.mumfrey.liteloader.core.ModInfo;
  6 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  7 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
  8 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator.DisabledReason;
  9 +import com.mumfrey.liteloader.interfaces.TweakContainer;
  10 +
  11 +/**
  12 + * LiteLoader Extensible API - Enumeration observer
  13 + *
  14 + * EnumerationObserver receive callbacks when mod containers are enumerated. Instances of this class MUST be returned from
  15 + * getPreInitObservers in order to work
  16 + *
  17 + * @author Adam Mummery-Smith
  18 + */
  19 +public interface EnumerationObserver extends Observer
  20 +{
  21 + /**
  22 + * Called upon registration for every discovered container which is enabled
  23 + *
  24 + * @param enumerator
  25 + * @param container
  26 + */
  27 + public abstract void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container);
  28 +
  29 + /**
  30 + * Called upon registration for every discovered container which is currently disabled, either because
  31 + *
  32 + * @param enumerator
  33 + * @param container
  34 + * @param reason
  35 + */
  36 + public abstract void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason);
  37 +
  38 + /**
  39 + * Called AFTER registration of an ENABLED container (eg. onRegisterEnabledContainer will be called first) if that container also
  40 + * contains tweaks.
  41 + *
  42 + * @param enumerator
  43 + * @param container
  44 + */
  45 + public abstract void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container);
  46 +
  47 + /**
  48 + * Called when a mod container is added to the pending mods list. This does not mean that the specific mod will actually be instanced since
  49 + * the mod can still be disabled via the exclusion list (this is to allow entire containers to be disabled or just individual mods) and so
  50 + * if you wish to observe actual mod instantiation you should still provide a {@link ModLoadObserver}. However this event expresses a
  51 + * declaration by the enumerator of an intention to load the specified mod.
  52 + *
  53 + * @param enumerator
  54 + * @param mod
  55 + */
  56 + public abstract void onModAdded(LoaderEnumerator enumerator, ModInfo<LoadableMod<?>> mod);
  57 +}
... ...
java/common/com/mumfrey/liteloader/api/LiteAPI.java
... ... @@ -58,14 +58,6 @@ public interface LiteAPI
58 58 public abstract String[] getRequiredDownstreamTransformers();
59 59  
60 60 /**
61   - * Should return an array of required packet transformer names, these transformers will be injected UPSTREAM. Can return null.
62   - *
63   - * Deprecated - will be removed in 1.8
64   - */
65   - @Deprecated
66   - public abstract String[] getPacketTransformers();
67   -
68   - /**
69 61 * Return a mod class prefix supported by this API, can return null if an API just wants to use "LiteMod" as a standard class name prefix
70 62 */
71 63 public abstract String getModClassPrefix();
... ... @@ -86,7 +78,14 @@ public interface LiteAPI
86 78 public abstract List<InterfaceProvider> getInterfaceProviders();
87 79  
88 80 /**
89   - * Should return a list of Observers for this API, can return null if the API doesn't have any Observers, (almost) guaranteed to only be called once
  81 + * Should return a list of Observers which are safe to instantiate during pre-init, for example EnumerationObservers. Can return null if the API doesn't have any
  82 + * Observers.
  83 + */
  84 + public abstract List<Observer> getPreInitObservers();
  85 +
  86 + /**
  87 + * Should return a list of Observers for this API, can return null if the API doesn't have any Observers, (almost) guaranteed to only be called once. This list may
  88 + * include Observers returned by getPreInitObservers if the observers are still required.
90 89 */
91 90 public abstract List<Observer> getObservers();
92 91  
... ...
java/common/com/mumfrey/liteloader/api/manager/APIAdapter.java
... ... @@ -25,12 +25,6 @@ public interface APIAdapter
25 25 public abstract List<String> getRequiredDownstreamTransformers();
26 26  
27 27 /**
28   - * Aggregate and return required packet transformers from all registered APIs
29   - */
30   - @Deprecated
31   - public abstract List<String> getPacketTransformers();
32   -
33   - /**
34 28 * Register interfaces from all registered APIs with the specified registry
35 29 */
36 30 public abstract void registerInterfaces(InterfaceRegistry interfaceManager);
... ... @@ -65,4 +59,16 @@ public interface APIAdapter
65 59 * @param observerType type of observer to search for
66 60 */
67 61 public abstract <T extends Observer> List<T> getAllObservers(Class<T> observerType);
  62 +
  63 + /**
  64 + * @param api
  65 + * @return
  66 + */
  67 + public abstract List<? extends Observer> getPreInitObservers(LiteAPI api);
  68 +
  69 + /**
  70 + * @param observerType
  71 + * @return
  72 + */
  73 + public abstract <T extends Observer> List<T> getPreInitObservers(Class<T> observerType);
68 74 }
... ...
java/common/com/mumfrey/liteloader/api/manager/APIProviderBasic.java
... ... @@ -36,6 +36,11 @@ class APIProviderBasic implements APIProvider, APIAdapter
36 36 private final Map<LiteAPI, List<? extends Observer>> observers = new HashMap<LiteAPI, List<? extends Observer>>();
37 37  
38 38 /**
  39 + * Cached preinit observers
  40 + */
  41 + private final Map<LiteAPI, List<? extends Observer>> preInitiObservers = new HashMap<LiteAPI, List<? extends Observer>>();
  42 +
  43 + /**
39 44 * Cached CoreProvider set
40 45 */
41 46 private List<CoreProvider> coreProviders;
... ... @@ -91,26 +96,6 @@ class APIProviderBasic implements APIProvider, APIAdapter
91 96 }
92 97  
93 98 /* (non-Javadoc)
94   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getPacketTransformers()
95   - */
96   - @Override
97   - public List<String> getPacketTransformers()
98   - {
99   - List<String> packetTransformers = new ArrayList<String>();
100   -
101   - for (LiteAPI api : this.apis)
102   - {
103   - String[] apiTransformers = api.getPacketTransformers();
104   - if (apiTransformers != null)
105   - {
106   - packetTransformers.addAll(Arrays.asList(apiTransformers));
107   - }
108   - }
109   -
110   - return packetTransformers;
111   - }
112   -
113   - /* (non-Javadoc)
114 99 * @see com.mumfrey.liteloader.api.manager.APIProvider#getObservers(com.mumfrey.liteloader.api.LiteAPI)
115 100 */
116 101 @Override
... ... @@ -125,6 +110,18 @@ class APIProviderBasic implements APIProvider, APIAdapter
125 110 return this.observers.get(api);
126 111 }
127 112  
  113 + @Override
  114 + public List<? extends Observer> getPreInitObservers(LiteAPI api)
  115 + {
  116 + if (!this.preInitiObservers.containsKey(api))
  117 + {
  118 + List<Observer> apiObservers = api.getPreInitObservers();
  119 + this.preInitiObservers.put(api, Collections.unmodifiableList(apiObservers != null ? apiObservers : new ArrayList<Observer>()));
  120 + }
  121 +
  122 + return this.preInitiObservers.get(api);
  123 + }
  124 +
128 125 @SuppressWarnings("unchecked")
129 126 @Override
130 127 public <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType)
... ... @@ -160,6 +157,25 @@ class APIProviderBasic implements APIProvider, APIAdapter
160 157  
161 158 return matchingObservers;
162 159 }
  160 +
  161 + @SuppressWarnings("unchecked")
  162 + @Override
  163 + public <T extends Observer> List<T> getPreInitObservers(Class<T> observerType)
  164 + {
  165 + List<T> matchingObservers = new ArrayList<T>();
  166 + for (LiteAPI api : this.apis)
  167 + {
  168 + for (Observer observer : this.getPreInitObservers(api))
  169 + {
  170 + if (observerType.isAssignableFrom(observer.getClass()) && !matchingObservers.contains(observer))
  171 + {
  172 + matchingObservers.add((T)observer);
  173 + }
  174 + }
  175 + }
  176 +
  177 + return matchingObservers;
  178 + }
163 179  
164 180 /* (non-Javadoc)
165 181 * @see com.mumfrey.liteloader.api.manager.APIProvider#registerInterfaceProviders(com.mumfrey.liteloader.core.InterfaceManager)
... ...
java/common/com/mumfrey/liteloader/core/ClientPluginChannels.java
1 1 package com.mumfrey.liteloader.core;
2 2  
3 3 import net.minecraft.network.INetHandler;
  4 +import net.minecraft.network.PacketBuffer;
4 5 import net.minecraft.network.play.server.S3FPacketCustomPayload;
5 6  
6 7 import com.mumfrey.liteloader.PluginChannelListener;
... ... @@ -78,7 +79,7 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
78 79 * @param channel
79 80 * @param data
80 81 */
81   - protected void onPluginChannelMessage(String channel, byte[] data)
  82 + protected void onPluginChannelMessage(String channel, PacketBuffer data)
82 83 {
83 84 if (PluginChannels.CHANNEL_REGISTER.equals(channel))
84 85 {
... ... @@ -91,12 +92,12 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
91 92 PermissionsManagerClient permissionsManager = LiteLoader.getClientPermissionsManager();
92 93 if (permissionsManager != null)
93 94 {
94   - permissionsManager.onCustomPayload(channel, data.length, data);
  95 + permissionsManager.onCustomPayload(channel, data);
95 96 }
96 97 }
97 98 catch (Exception ex) {}
98 99  
99   - this.onModPacketReceived(channel, data, data.length);
  100 + this.onModPacketReceived(channel, data);
100 101 }
101 102 }
102 103  
... ... @@ -105,13 +106,13 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
105 106 * @param data
106 107 * @param length
107 108 */
108   - protected void onModPacketReceived(String channel, byte[] data, int length)
  109 + protected void onModPacketReceived(String channel, PacketBuffer data)
109 110 {
110 111 for (PluginChannelListener pluginChannelListener : this.pluginChannels.get(channel))
111 112 {
112 113 try
113 114 {
114   - pluginChannelListener.onCustomPayload(channel, length, data);
  115 + pluginChannelListener.onCustomPayload(channel, data);
115 116 throw new RuntimeException();
116 117 }
117 118 catch (Exception ex)
... ... @@ -146,7 +147,7 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
146 147 this.addPluginChannelsFor(pluginChannelListener);
147 148 }
148 149  
149   - byte[] registrationData = this.getRegistrationData();
  150 + PacketBuffer registrationData = this.getRegistrationData();
150 151 if (registrationData != null)
151 152 {
152 153 this.sendRegistrationData(netHandler, registrationData);
... ... @@ -162,7 +163,7 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
162 163 * @param netHandler
163 164 * @param registrationData
164 165 */
165   - protected abstract void sendRegistrationData(INetHandler netHandler, byte[] registrationData);
  166 + protected abstract void sendRegistrationData(INetHandler netHandler, PacketBuffer registrationData);
166 167  
167 168 /**
168 169 * Send a message to the server on a plugin channel
... ... @@ -170,7 +171,7 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
170 171 * @param channel Channel to send, must not be a reserved channel name
171 172 * @param data
172 173 */
173   - public static boolean sendMessage(String channel, byte[] data, ChannelPolicy policy)
  174 + public static boolean sendMessage(String channel, PacketBuffer data, ChannelPolicy policy)
174 175 {
175 176 if (ClientPluginChannels.instance != null)
176 177 {
... ... @@ -186,5 +187,5 @@ public abstract class ClientPluginChannels extends PluginChannels&lt;PluginChannelL
186 187 * @param channel Channel to send, must not be a reserved channel name
187 188 * @param data
188 189 */
189   - protected abstract boolean send(String channel, byte[] data, ChannelPolicy policy);
  190 + protected abstract boolean send(String channel, PacketBuffer data, ChannelPolicy policy);
190 191 }
... ...
java/common/com/mumfrey/liteloader/core/LiteLoader.java
... ... @@ -12,6 +12,7 @@ import net.minecraft.client.resources.IResourcePack;
12 12 import net.minecraft.crash.CrashReport;
13 13 import net.minecraft.crash.CrashReportCategory;
14 14 import net.minecraft.launchwrapper.LaunchClassLoader;
  15 +import net.minecraft.network.EnumConnectionState;
15 16 import net.minecraft.network.INetHandler;
16 17 import net.minecraft.network.play.server.S01PacketJoinGame;
17 18 import net.minecraft.profiler.Profiler;
... ... @@ -51,6 +52,7 @@ import com.mumfrey.liteloader.modconfig.ConfigManager;
51 52 import com.mumfrey.liteloader.modconfig.Exposable;
52 53 import com.mumfrey.liteloader.permissions.PermissionsManagerClient;
53 54 import com.mumfrey.liteloader.permissions.PermissionsManagerServer;
  55 +import com.mumfrey.liteloader.transformers.event.EventTransformer;
54 56 import com.mumfrey.liteloader.util.Input;
55 57 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
56 58  
... ... @@ -568,6 +570,19 @@ public final class LiteLoader
568 570 return "true".equals(System.getProperty("mcpenv"));
569 571 }
570 572  
  573 + public static void dumpDebugInfo()
  574 + {
  575 + if (LiteLoaderLogger.DEBUG)
  576 + {
  577 + EventTransformer.dumpInjectionState();
  578 + LiteLoaderLogger.info("Debug info dumped to console");
  579 + }
  580 + else
  581 + {
  582 + LiteLoaderLogger.info("Debug dump not available, developer flag not enabled");
  583 + }
  584 + }
  585 +
571 586 /**
572 587 * Used for crash reporting, returns a text list of all loaded mods
573 588 *
... ... @@ -914,6 +929,9 @@ public final class LiteLoader
914 929 }
915 930  
916 931 MessageBus.getInstance().onStartupComplete();
  932 +
  933 + // Force packet injections
  934 + EnumConnectionState.values();
917 935 }
918 936  
919 937 /**
... ...
java/common/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
... ... @@ -716,15 +716,11 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
716 716 @Override
717 717 public List<String> getRequiredDownstreamTransformers()
718 718 {
719   - return this.apiAdapter.getRequiredDownstreamTransformers();
  719 + List<String> requiredDownstreamTransformers = this.apiAdapter.getRequiredDownstreamTransformers();
  720 + requiredDownstreamTransformers.add(0, "com.mumfrey.liteloader.transformers.event.EventTransformer");
  721 + return requiredDownstreamTransformers;
720 722 }
721 723  
722   - @Override
723   - public List<String> getPacketTransformers()
724   - {
725   - return this.apiAdapter.getPacketTransformers();
726   - }
727   -
728 724 private static int tryParseInt(String string, int defaultValue)
729 725 {
730 726 try
... ...
java/common/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
... ... @@ -19,13 +19,16 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
19 19  
20 20 import com.google.common.base.Throwables;
21 21 import com.mumfrey.liteloader.LiteMod;
  22 +import com.mumfrey.liteloader.api.EnumerationObserver;
22 23 import com.mumfrey.liteloader.api.EnumeratorModule;
23 24 import com.mumfrey.liteloader.api.LiteAPI;
24 25 import com.mumfrey.liteloader.api.manager.APIProvider;
  26 +import com.mumfrey.liteloader.core.event.HandlerList;
25 27 import com.mumfrey.liteloader.core.exceptions.OutdatedLoaderException;
26   -import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
  28 +import com.mumfrey.liteloader.interfaces.FastIterableDeque;
27 29 import com.mumfrey.liteloader.interfaces.Loadable;
28 30 import com.mumfrey.liteloader.interfaces.LoadableMod;
  31 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
29 32 import com.mumfrey.liteloader.interfaces.TweakContainer;
30 33 import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
31 34 import com.mumfrey.liteloader.launch.LoaderEnvironment;
... ... @@ -114,6 +117,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
114 117  
115 118 private final String[] supportedPrefixes;
116 119  
  120 + private final FastIterableDeque<EnumerationObserver> observers = new HandlerList<EnumerationObserver>(EnumerationObserver.class);
  121 +
117 122 protected EnumeratorState state = EnumeratorState.INIT;
118 123  
119 124 /**
... ... @@ -129,6 +134,9 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
129 134 this.tweaker = (LiteLoaderTweaker)environment.getTweaker();
130 135 this.classLoader = classLoader;
131 136 this.supportedPrefixes = this.getSupportedPrefixes(environment);
  137 +
  138 + // Initialise observers
  139 + this.observers.addAll(environment.getAPIAdapter().getPreInitObservers(EnumerationObserver.class));
132 140  
133 141 // Initialise the shared mod list if we haven't already
134 142 this.getSharedModList();
... ... @@ -459,21 +467,21 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
459 467 if (!container.isEnabled(this.environment))
460 468 {
461 469 LiteLoaderLogger.info("Container %s is disabled", container.getLocation());
462   - this.registerDisabledContainer(container);
  470 + this.registerDisabledContainer(container, DisabledReason.USER_DISABLED);
463 471 return false;
464 472 }
465 473  
466 474 if (!this.checkDependencies(container))
467 475 {
468 476 LiteLoaderLogger.info("Container %s is missing one or more dependencies", container.getLocation());
469   - this.registerDisabledContainer(container);
  477 + this.registerDisabledContainer(container, DisabledReason.MISSING_DEPENDENCY);
470 478 return false;
471 479 }
472 480  
473 481 if (!this.checkAPIRequirements(container))
474 482 {
475 483 LiteLoaderLogger.info("Container %s is missing one or more required APIs", container.getLocation());
476   - this.registerDisabledContainer(container);
  484 + this.registerDisabledContainer(container, DisabledReason.MISSING_API);
477 485 return false;
478 486 }
479 487  
... ... @@ -492,17 +500,21 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
492 500  
493 501 this.disabledContainers.remove(container.getIdentifier());
494 502 this.enabledContainers.put(container.getIdentifier(), container);
  503 +
  504 + this.observers.all().onRegisterEnabledContainer(this, container);
495 505 }
496 506  
497 507 /**
498 508 * @param container
499 509 */
500   - protected void registerDisabledContainer(LoadableMod<?> container)
  510 + protected void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason)
501 511 {
502 512 this.checkState(EnumeratorState.DISCOVER, "registerDisabledContainer");
503 513  
504 514 this.enabledContainers.remove(container.getIdentifier());
505 515 this.disabledContainers.put(container.getIdentifier(), new NonMod(container, false));
  516 +
  517 + this.observers.all().onRegisterDisabledContainer(this, container, reason);
506 518 }
507 519  
508 520 /* (non-Javadoc)
... ... @@ -520,6 +532,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
520 532 }
521 533  
522 534 this.tweakContainers.add(container);
  535 + this.observers.all().onRegisterTweakContainer(this, container);
523 536 return true;
524 537 }
525 538  
... ... @@ -655,6 +668,8 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
655 668 }
656 669  
657 670 this.modsToLoad.add(mod);
  671 +
  672 + this.observers.all().onModAdded(this, mod);
658 673 }
659 674  
660 675 /**
... ...
java/common/com/mumfrey/liteloader/core/LiteLoaderVersion.java
... ... @@ -7,7 +7,7 @@ import java.util.Set;
7 7 * LiteLoader version table
8 8 *
9 9 * @author Adam Mummery-Smith
10   - * @version 1.7.10_04
  10 + * @version 1.8.0_00
11 11 */
12 12 public enum LiteLoaderVersion
13 13 {
... ... @@ -37,12 +37,13 @@ public enum LiteLoaderVersion
37 37 MC_1_7_10_R1(28, 1404673785, "1.7.10", "1.7.10_01", "1.7.10"),
38 38 MC_1_7_10_R2(29, 1405369406, "1.7.10", "1.7.10_02", "1.7.10"),
39 39 MC_1_7_10_R3(30, 1407687918, "1.7.10", "1.7.10_03", "1.7.10", "1.7.10_03"),
40   - MC_1_7_10_R4(31, 0, "1.7.10", "1.7.10_04", "1.7.10", "1.7.10_03", "1.7.10_04");
  40 + MC_1_7_10_R4(31, 0, "1.7.10", "1.7.10_04", "1.7.10", "1.7.10_03", "1.7.10_04"),
  41 + MC_1_8_0_R0(32, 0, "1.8.0", "1.8.0", "1.8", "1.8.0");
41 42  
42 43 /**
43 44 * Current loader version
44 45 */
45   - public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_7_10_R4;
  46 + public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_8_0_R0;
46 47  
47 48 private static final LiteLoaderUpdateSite updateSite = new LiteLoaderUpdateSite(LiteLoaderVersion.CURRENT.getMinecraftVersion(), LiteLoaderVersion.CURRENT.getReleaseTimestamp());
48 49  
... ...
java/common/com/mumfrey/liteloader/core/PacketEvents.java
... ... @@ -220,7 +220,7 @@ public abstract class PacketEvents implements InterfaceProvider
220 220 {
221 221 EntityPlayerMP player = netHandler instanceof NetHandlerPlayServer ? ((NetHandlerPlayServer)netHandler).playerEntity : null;
222 222  
223   - if (!this.serverChatFilters.all().onChat(player, packet, packet.func_149439_c()))
  223 + if (!this.serverChatFilters.all().onChat(player, packet, packet.getMessage()))
224 224 {
225 225 e.cancel();
226 226 }
... ...
java/common/com/mumfrey/liteloader/core/PluginChannels.java
1 1 package com.mumfrey.liteloader.core;
2 2  
3   -import java.io.UnsupportedEncodingException;
4   -import java.nio.charset.Charset;
  3 +import io.netty.buffer.Unpooled;
  4 +
5 5 import java.util.Collections;
6 6 import java.util.HashMap;
7 7 import java.util.HashSet;
... ... @@ -10,11 +10,11 @@ import java.util.List;
10 10 import java.util.Map;
11 11 import java.util.Set;
12 12  
  13 +import net.minecraft.network.INetHandler;
  14 +import net.minecraft.network.PacketBuffer;
  15 +
13 16 import com.mumfrey.liteloader.api.InterfaceProvider;
14 17 import com.mumfrey.liteloader.interfaces.FastIterableDeque;
15   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
16   -
17   -import net.minecraft.network.INetHandler;
18 18  
19 19 /**
20 20 * Manages plugin channel connections and subscriptions for LiteLoader
... ... @@ -115,19 +115,12 @@ public abstract class PluginChannels&lt;L extends CommonPluginChannelListener&gt; impl
115 115 /**
116 116 * @param data
117 117 */
118   - protected void onRegisterPacketReceived(byte[] data)
  118 + protected void onRegisterPacketReceived(PacketBuffer data)
119 119 {
120   - try
121   - {
122   - String channels = new String(data, "UTF8");
123   - for (String channel : channels.split("\u0000"))
124   - {
125   - this.remotePluginChannels.add(channel);
126   - }
127   - }
128   - catch (UnsupportedEncodingException ex)
  120 + String channels = data.readStringFromBuffer(65535);
  121 + for (String channel : channels.split("\u0000"))
129 122 {
130   - LiteLoaderLogger.warning(ex, "Error decoding REGISTER packet from remote host %s", ex.getClass().getSimpleName());
  123 + this.remotePluginChannels.add(channel);
131 124 }
132 125 }
133 126  
... ... @@ -135,7 +128,7 @@ public abstract class PluginChannels&lt;L extends CommonPluginChannelListener&gt; impl
135 128 * @return
136 129 *
137 130 */
138   - protected byte[] getRegistrationData()
  131 + protected PacketBuffer getRegistrationData()
139 132 {
140 133 // If any mods have registered channels, send the REGISTER packet
141 134 if (this.pluginChannels.keySet().size() > 0)
... ... @@ -150,7 +143,7 @@ public abstract class PluginChannels&lt;L extends CommonPluginChannelListener&gt; impl
150 143 separator = true;
151 144 }
152 145  
153   - return channelList.toString().getBytes(Charset.forName("UTF8"));
  146 + return new PacketBuffer(Unpooled.buffer()).writeString(channelList.toString());
154 147 }
155 148  
156 149 return null;
... ... @@ -184,20 +177,6 @@ public abstract class PluginChannels&lt;L extends CommonPluginChannelListener&gt; impl
184 177 }
185 178  
186 179 /**
187   - * Send a message on a plugin channel
188   - *
189   - * @param channel Channel to send, must not be a reserved channel name
190   - * @param data
191   - *
192   - * @deprecated Use ClientPluginChannels.sendMessage instead
193   - */
194   - @Deprecated
195   - public static boolean sendMessage(String channel, byte[] data, ChannelPolicy policy)
196   - {
197   - return ClientPluginChannels.sendMessage(channel, data, policy);
198   - }
199   -
200   - /**
201 180 * Policy for dispatching plugin channel packets
202 181 *
203 182 * @author Adam Mummery-Smith
... ...
java/common/com/mumfrey/liteloader/core/ServerPluginChannels.java
... ... @@ -3,6 +3,7 @@ package com.mumfrey.liteloader.core;
3 3 import net.minecraft.entity.player.EntityPlayerMP;
4 4 import net.minecraft.network.INetHandler;
5 5 import net.minecraft.network.NetHandlerPlayServer;
  6 +import net.minecraft.network.PacketBuffer;
6 7 import net.minecraft.network.play.client.C17PacketCustomPayload;
7 8 import net.minecraft.network.play.server.S3FPacketCustomPayload;
8 9  
... ... @@ -103,10 +104,10 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
103 104 */
104 105 public void onPluginChannelMessage(INetHandler netHandler, C17PacketCustomPayload customPayload)
105 106 {
106   - if (customPayload != null && customPayload.func_149559_c() != null)
  107 + if (customPayload != null && customPayload.getChannelName() != null)
107 108 {
108   - String channel = customPayload.func_149559_c();
109   - byte[] data = customPayload.func_149558_e();
  109 + String channel = customPayload.getChannelName();
  110 + PacketBuffer data = customPayload.getBufferData();
110 111  
111 112 EntityPlayerMP sender = ((NetHandlerPlayServer)netHandler).playerEntity;
112 113 this.onPluginChannelMessage(sender, channel, data);
... ... @@ -117,7 +118,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
117 118 * @param channel
118 119 * @param data
119 120 */
120   - private final void onPluginChannelMessage(EntityPlayerMP sender, String channel, byte[] data)
  121 + private final void onPluginChannelMessage(EntityPlayerMP sender, String channel, PacketBuffer data)
121 122 {
122 123 if (PluginChannels.CHANNEL_REGISTER.equals(channel))
123 124 {
... ... @@ -130,12 +131,12 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
130 131 PermissionsManagerServer permissionsManager = LiteLoader.getServerPermissionsManager();
131 132 if (permissionsManager != null)
132 133 {
133   - permissionsManager.onCustomPayload(sender, channel, data.length, data);
  134 + permissionsManager.onCustomPayload(sender, channel, data);
134 135 }
135 136 }
136 137 catch (Exception ex) {}
137 138  
138   - this.onModPacketReceived(sender, channel, data, data.length);
  139 + this.onModPacketReceived(sender, channel, data);
139 140 }
140 141 }
141 142  
... ... @@ -144,13 +145,13 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
144 145 * @param data
145 146 * @param length
146 147 */
147   - protected void onModPacketReceived(EntityPlayerMP sender, String channel, byte[] data, int length)
  148 + protected void onModPacketReceived(EntityPlayerMP sender, String channel, PacketBuffer data)
148 149 {
149 150 for (ServerPluginChannelListener pluginChannelListener : this.pluginChannels.get(channel))
150 151 {
151 152 try
152 153 {
153   - pluginChannelListener.onCustomPayload(sender, channel, length, data);
  154 + pluginChannelListener.onCustomPayload(sender, channel, data);
154 155 throw new RuntimeException();
155 156 }
156 157 catch (Exception ex)
... ... @@ -176,7 +177,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
176 177 {
177 178 try
178 179 {
179   - byte[] registrationData = this.getRegistrationData();
  180 + PacketBuffer registrationData = this.getRegistrationData();
180 181 if (registrationData != null)
181 182 {
182 183 this.sendRegistrationData(player, registrationData);
... ... @@ -184,7 +185,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
184 185 }
185 186 catch (Exception ex)
186 187 {
187   - LiteLoaderLogger.warning(ex, "Error dispatching REGISTER packet to client %s", player.getCommandSenderName());
  188 + LiteLoaderLogger.warning(ex, "Error dispatching REGISTER packet to client %s", player.getName());
188 189 }
189 190 }
190 191  
... ... @@ -192,7 +193,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
192 193 * @param netHandler
193 194 * @param registrationData
194 195 */
195   - private void sendRegistrationData(EntityPlayerMP recipient, byte[] registrationData)
  196 + private void sendRegistrationData(EntityPlayerMP recipient, PacketBuffer registrationData)
196 197 {
197 198 ServerPluginChannels.dispatch(recipient, new S3FPacketCustomPayload(CHANNEL_REGISTER, registrationData));
198 199 }
... ... @@ -204,7 +205,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
204 205 * @param channel Channel to send, must not be a reserved channel name
205 206 * @param data
206 207 */
207   - public static boolean sendMessage(EntityPlayerMP recipient, String channel, byte[] data, ChannelPolicy policy)
  208 + public static boolean sendMessage(EntityPlayerMP recipient, String channel, PacketBuffer data, ChannelPolicy policy)
208 209 {
209 210 if (ServerPluginChannels.instance != null)
210 211 {
... ... @@ -221,7 +222,7 @@ public class ServerPluginChannels extends PluginChannels&lt;ServerPluginChannelList
221 222 * @param channel Channel to send, must not be a reserved channel name
222 223 * @param data
223 224 */
224   - private boolean send(EntityPlayerMP recipient, String channel, byte[] data, ChannelPolicy policy)
  225 + private boolean send(EntityPlayerMP recipient, String channel, PacketBuffer data, ChannelPolicy policy)
225 226 {
226 227 if (recipient == null) return false;
227 228  
... ...
java/common/com/mumfrey/liteloader/core/api/EnumeratorModuleFolder.java
... ... @@ -224,7 +224,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule
224 224 * @param candidateFile
225 225 * @param strVersion
226 226 */
227   - private void addModFile(File candidateFile, String strVersion)
  227 + protected void addModFile(File candidateFile, String strVersion)
228 228 {
229 229 LoadableModFile modFile = new LoadableModFile(candidateFile, strVersion);
230 230  
... ... @@ -253,7 +253,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule
253 253 * @param enumerator
254 254 */
255 255 @SuppressWarnings("unchecked")
256   - private void sortAndAllocateFiles(ModularEnumerator enumerator)
  256 + protected void sortAndAllocateFiles(ModularEnumerator enumerator)
257 257 {
258 258 // Copy the first entry in every version set into the modfiles list
259 259 for (Entry<String, TreeSet<LoadableMod<File>>> modFileEntry : this.versionOrderingSets.entrySet())
... ...
java/common/com/mumfrey/liteloader/core/api/LoadableModClassPath.java
1 1 package com.mumfrey.liteloader.core.api;
2 2  
3 3 import java.io.File;
4   -import java.io.IOException;
5 4 import java.net.MalformedURLException;
6   -import java.util.zip.ZipEntry;
7   -import java.util.zip.ZipFile;
8 5  
9 6 import net.minecraft.launchwrapper.LaunchClassLoader;
10 7  
11 8 import com.google.common.base.Charsets;
12   -import com.google.common.io.Files;
13 9 import com.mumfrey.liteloader.core.LiteLoaderVersion;
14 10 import com.mumfrey.liteloader.interfaces.LoadableMod;
15 11 import com.mumfrey.liteloader.resources.ModResourcePack;
... ... @@ -111,39 +107,6 @@ public class LoadableModClassPath extends LoadableModFile
111 107  
112 108 private static String getVersionMetaDataString(File file)
113 109 {
114   - try
115   - {
116   - if (file.isDirectory())
117   - {
118   - File versionMetaFile = new File(file, LoadableMod.METADATA_FILENAME);
119   - if (versionMetaFile.exists())
120   - {
121   - return Files.toString(versionMetaFile, Charsets.UTF_8);
122   - }
123   - }
124   - else
125   - {
126   - String strVersion = null;
127   - ZipFile modZip = new ZipFile(file);
128   - ZipEntry versionEntry = modZip.getEntry(LoadableMod.METADATA_FILENAME);
129   - if (versionEntry != null)
130   - {
131   - try
132   - {
133   - strVersion = LoadableModFile.zipEntryToString(modZip, versionEntry);
134   - }
135   - catch (IOException ex) {}
136   - }
137   -
138   - modZip.close();
139   - return strVersion;
140   - }
141   - }
142   - catch (IOException ex)
143   - {
144   - ex.printStackTrace();
145   - }
146   -
147   - return null;
  110 + return LoadableModFile.getFileContents(file, LoadableMod.METADATA_FILENAME, Charsets.UTF_8);
148 111 }
149 112 }
... ...
java/common/com/mumfrey/liteloader/core/api/LoadableModFile.java
... ... @@ -22,6 +22,7 @@ import net.minecraft.client.resources.I18n;
22 22  
23 23 import com.google.common.base.Charsets;
24 24 import com.google.common.io.ByteStreams;
  25 +import com.google.common.io.Files;
25 26 import com.google.gson.Gson;
26 27 import com.google.gson.JsonSyntaxException;
27 28 import com.mumfrey.liteloader.api.manager.APIProvider;
... ... @@ -485,6 +486,16 @@ public class LoadableModFile extends LoadableFile implements LoadableMod&lt;File&gt;
485 486 // Give up and use timestamp
486 487 return (int)(otherMod.timeStamp - this.timeStamp);
487 488 }
  489 +
  490 + /**
  491 + * @param name
  492 + * @param charset
  493 + * @return
  494 + */
  495 + public String getFileContents(String name, Charset charset)
  496 + {
  497 + return LoadableModFile.getFileContents(this, name, charset);
  498 + }
488 499  
489 500 /**
490 501 * @return
... ... @@ -600,4 +611,48 @@ public class LoadableModFile extends LoadableFile implements LoadableMod&lt;File&gt;
600 611  
601 612 return new String(bytes, bomOffset, bytes.length - bomOffset, charset);
602 613 }
  614 +
  615 + /**
  616 + * @param parent
  617 + * @param name
  618 + * @param charset
  619 + * @return
  620 + */
  621 + public static String getFileContents(File parent, String name, Charset charset)
  622 + {
  623 + try
  624 + {
  625 + if (parent.isDirectory())
  626 + {
  627 + File file = new File(parent, name);
  628 + if (file.isFile())
  629 + {
  630 + return Files.toString(file, charset);
  631 + }
  632 + }
  633 + else
  634 + {
  635 + String content = null;
  636 + ZipFile zipFile = new ZipFile(parent);
  637 + ZipEntry zipEntry = zipFile.getEntry(name);
  638 + if (zipEntry != null)
  639 + {
  640 + try
  641 + {
  642 + content = LoadableModFile.zipEntryToString(zipFile, zipEntry);
  643 + }
  644 + catch (IOException ex) {}
  645 + }
  646 +
  647 + zipFile.close();
  648 + return content;
  649 + }
  650 + }
  651 + catch (IOException ex)
  652 + {
  653 + ex.printStackTrace();
  654 + }
  655 +
  656 + return null;
  657 + }
603 658 }
... ...
java/common/com/mumfrey/liteloader/core/event/EventProxy.java
... ... @@ -9,6 +9,7 @@ import net.minecraft.crash.CrashReportCategory;
9 9  
10 10 import org.objectweb.asm.Type;
11 11  
  12 +import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
12 13 import com.mumfrey.liteloader.transformers.event.EventInfo;
13 14  
14 15 /**
... ... @@ -147,19 +148,11 @@ public final class EventProxy
147 148  
148 149 return tpl.toString();
149 150 }
150   -
  151 +
151 152 private static boolean appendTypeName(StringBuilder tpl, Type type, String sourceClass)
152 153 {
153 154 switch (type.getSort())
154 155 {
155   - case Type.BOOLEAN: tpl.append("boolean"); return false;
156   - case Type.CHAR: tpl.append("char"); return false;
157   - case Type.BYTE: tpl.append("byte"); return false;
158   - case Type.SHORT: tpl.append("short"); return false;
159   - case Type.INT: tpl.append("int"); return false;
160   - case Type.FLOAT: tpl.append("float"); return false;
161   - case Type.LONG: tpl.append("long"); return false;
162   - case Type.DOUBLE: tpl.append("double"); return false;
163 156 case Type.ARRAY:
164 157 EventProxy.appendTypeName(tpl, type.getElementType(), sourceClass);
165 158 return true;
... ... @@ -170,11 +163,10 @@ public final class EventProxy
170 163 if (typeName.endsWith("ReturnEventInfo")) tpl.append('<').append(sourceClass).append(", ?>");
171 164 else if (typeName.endsWith("EventInfo")) tpl.append('<').append(sourceClass).append('>');
172 165 return false;
  166 + default:
  167 + tpl.append(ByteCodeUtilities.getTypeName(type));
  168 + return false;
173 169 }
174   -
175   - tpl.append("Object");
176   -
177   - return false;
178 170 }
179 171  
180 172 private static void addDetailLineBreak()
... ...
java/common/com/mumfrey/liteloader/core/runtime/Methods.java
... ... @@ -13,11 +13,13 @@ public abstract class Methods
13 13 public static final MethodInfo runTick = new MethodInfo(Obf.Minecraft, Obf.runTick, Void.TYPE);
14 14 public static final MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
15 15 public static final MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
  16 + public static final MethodInfo framebufferRenderExt = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRenderExt, Void.TYPE, Integer.TYPE, Integer.TYPE, Boolean.TYPE);
16 17 public static final MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
17   - public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityClientPlayerMP, Obf.sendChatMessage, Void.TYPE, String.class);
  18 + public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityPlayerSP, Obf.sendChatMessage, Void.TYPE, String.class);
18 19 public static final MethodInfo renderWorld = new MethodInfo(Obf.EntityRenderer, Obf.renderWorld, Void.TYPE, Float.TYPE, Long.TYPE);
  20 + public static final MethodInfo renderWorldPass = new MethodInfo(Obf.EntityRenderer, Obf.renderWorldPass, Void.TYPE, Integer.TYPE, Float.TYPE, Long.TYPE);
19 21 public static final MethodInfo updateCameraAndRender = new MethodInfo(Obf.EntityRenderer, Obf.updateCameraAndRender, Void.TYPE, Float.TYPE);
20   - public static final MethodInfo renderGameOverlay = new MethodInfo(Obf.GuiIngame, Obf.renderGameOverlay, Void.TYPE, Float.TYPE, Boolean.TYPE, Integer.TYPE, Integer.TYPE);
  22 + public static final MethodInfo renderGameOverlay = new MethodInfo(Obf.GuiIngame, Obf.renderGameOverlay, Void.TYPE, Float.TYPE);
21 23 public static final MethodInfo drawChat = new MethodInfo(Obf.GuiNewChat, Obf.drawChat, Void.TYPE, Integer.TYPE);
22 24 public static final MethodInfo integratedServerCtor = new MethodInfo(Obf.IntegratedServer, Obf.constructor, Void.TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings);
23 25 public static final MethodInfo initPlayerConnection = new MethodInfo(Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, Void.TYPE, Obf.NetworkManager, Obf.EntityPlayerMP);
... ... @@ -25,12 +27,12 @@ public abstract class Methods
25 27 public static final MethodInfo playerLoggedOut = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedOut, Void.TYPE, Obf.EntityPlayerMP);
26 28 public static final MethodInfo spawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.spawnPlayer, Obf.EntityPlayerMP, Obf.GameProfile);
27 29 public static final MethodInfo respawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.respawnPlayer, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Integer.TYPE, Boolean.TYPE);
  30 + public static final MethodInfo glClear = new MethodInfo(Obf.GlStateManager, Obf.clear, Void.TYPE, Integer.TYPE);
  31 + public static final MethodInfo getProfile = new MethodInfo(Obf.Session, Obf.getProfile, Obf.GameProfile);
28 32  
29 33 public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class);
30 34 public static final MethodInfo endSection = new MethodInfo(Obf.Profiler, Obf.endSection, Void.TYPE);
31 35 public static final MethodInfo endStartSection = new MethodInfo(Obf.Profiler, Obf.endStartSection, Void.TYPE, String.class);
32   -
33   - public static final MethodInfo glClear = new MethodInfo(Obf.GL11, "glClear", "(I)V");
34 36  
35 37 private Methods() {}
36 38 }
... ...
java/common/com/mumfrey/liteloader/core/runtime/Obf.java
... ... @@ -2,13 +2,16 @@ package com.mumfrey.liteloader.core.runtime;
2 2  
3 3 import java.io.IOException;
4 4 import java.io.InputStream;
  5 +import java.lang.reflect.Field;
  6 +import java.util.HashMap;
  7 +import java.util.Map;
5 8 import java.util.Properties;
6 9  
7 10 /**
8 11 * Centralised obfuscation table for LiteLoader
9 12 *
10 13 * @author Adam Mummery-Smith
11   - * TODO Obfuscation 1.7.10
  14 + * TODO Obfuscation 1.8
12 15 */
13 16 public class Obf
14 17 {
... ... @@ -29,77 +32,91 @@ public class Obf
29 32  
30 33 // Classes
31 34 // -----------------------------------------------------------------------------------------
32   - public static final Obf Minecraft = new Obf("net.minecraft.client.Minecraft", "bao" );
33   - public static final Obf EntityRenderer = new Obf("net.minecraft.client.renderer.EntityRenderer", "blt" );
34   - public static final Obf GuiIngame = new Obf("net.minecraft.client.gui.GuiIngame", "bbv" );
35   - public static final Obf Profiler = new Obf("net.minecraft.profiler.Profiler", "qi" );
  35 + public static final Obf Minecraft = new Obf("net.minecraft.client.Minecraft", "bsu" );
  36 + public static final Obf EntityRenderer = new Obf("net.minecraft.client.renderer.EntityRenderer", "cji" );
  37 + public static final Obf GuiIngame = new Obf("net.minecraft.client.gui.GuiIngame", "btz" );
  38 + public static final Obf Profiler = new Obf("net.minecraft.profiler.Profiler", "uw" );
36 39 public static final Obf CrashReport$6 = new Obf("net.minecraft.crash.CrashReport$6", "h" );
37   - public static final Obf INetHandler = new Obf("net.minecraft.network.INetHandler", "fb" );
38   - public static final Obf IntegratedServer = new Obf("net.minecraft.server.integrated.IntegratedServer", "bsx" );
39   - public static final Obf WorldSettings = new Obf("net.minecraft.world.WorldSettings", "ahj" );
40   - public static final Obf ServerConfigurationManager = new Obf("net.minecraft.server.management.ServerConfigurationManager", "oi" );
41   - public static final Obf EntityPlayerMP = new Obf("net.minecraft.entity.player.EntityPlayerMP", "mw" );
42   - public static final Obf NetworkManager = new Obf("net.minecraft.network.NetworkManager", "ej" );
43   - public static final Obf DedicatedServer = new Obf("net.minecraft.server.dedicated.DedicatedServer", "lt" );
44   - public static final Obf EntityClientPlayerMP = new Obf("net.minecraft.client.entity.EntityClientPlayerMP", "bjk" );
45   - public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "ajn" );
46   - public static final Obf Items = new Obf("net.minecraft.init.Items", "ade" );
47   - public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "bmg" );
48   - public static final Obf GuiNewChat = new Obf("net.minecraft.client.gui.GuiNewChat", "bcc" );
49   -
50   - // Packets
51   - // -----------------------------------------------------------------------------------------
52   - @Deprecated public static final Obf S01PacketJoinGame = Packets.S01PacketJoinGame;
53   - @Deprecated public static final Obf S02PacketLoginSuccess = Packets.S02PacketLoginSuccess;
54   - @Deprecated public static final Obf S02PacketChat = Packets.S02PacketChat;
55   - @Deprecated public static final Obf S3FPacketCustomPayload = Packets.S3FPacketCustomPayload;
56   - @Deprecated public static final Obf C01PacketChatMessage = Packets.C01PacketChatMessage;
57   - @Deprecated public static final Obf C17PacketCustomPayload = Packets.C17PacketCustomPayload;
  40 + public static final Obf INetHandler = new Obf("net.minecraft.network.INetHandler", "hg" );
  41 + public static final Obf IntegratedServer = new Obf("net.minecraft.server.integrated.IntegratedServer", "cyk" );
  42 + public static final Obf WorldSettings = new Obf("net.minecraft.world.WorldSettings", "arb" );
  43 + public static final Obf ServerConfigurationManager = new Obf("net.minecraft.server.management.ServerConfigurationManager", "sn" );
  44 + public static final Obf EntityPlayerMP = new Obf("net.minecraft.entity.player.EntityPlayerMP", "qw" );
  45 + public static final Obf NetworkManager = new Obf("net.minecraft.network.NetworkManager", "gr" );
  46 + public static final Obf DedicatedServer = new Obf("net.minecraft.server.dedicated.DedicatedServer", "po" );
  47 + public static final Obf EntityPlayerSP = new Obf("net.minecraft.client.entity.EntityPlayerSP", "cio" );
  48 + public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "aty" );
  49 + public static final Obf Items = new Obf("net.minecraft.init.Items", "amk" );
  50 + public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "ckw" );
  51 + public static final Obf GuiNewChat = new Obf("net.minecraft.client.gui.GuiNewChat", "buh" );
  52 + public static final Obf GlStateManager = new Obf("net.minecraft.client.renderer.GlStateManager", "cjm" );
  53 + public static final Obf Session = new Obf("net.minecraft.util.Session", "btw" );
58 54  
59 55 // Fields
60 56 // -----------------------------------------------------------------------------------------
61   - public static final Obf minecraftProfiler = new Obf("field_71424_I", "z" ); // Minecraft/mcProfiler
62   - public static final Obf entityRenderMap = new Obf("field_78729_o", "q" ); // RenderManager/entityRenderMap
63   - public static final Obf reloadListeners = new Obf("field_110546_b", "d" ); // SimpleReloadableResourceManager/reloadListeners
64   - public static final Obf netManager = new Obf("field_147393_d", "d" ); // NetHandlerLoginClient/field_147393_d
65   - public static final Obf registryObjects = new Obf("field_82596_a", "c" ); // RegistrySimple/registryObjects
66   - public static final Obf underlyingIntegerMap = new Obf("field_148759_a", "a" ); // RegistryNamespaced/underlyingIntegerMap
67   - public static final Obf identityMap = new Obf("field_148749_a", "a" ); // ObjectIntIdentityMap/field_148749_a
68   - public static final Obf objectList = new Obf("field_148748_b", "b" ); // ObjectIntIdentityMap/field_148748_b
69   - public static final Obf mapSpecialRenderers = new Obf("field_147559_m", "m" ); // TileEntityRendererDispatcher/mapSpecialRenderers
70   - public static final Obf tileEntityNameToClassMap = new Obf("field_145855_i", "i" ); // TileEntity/nameToClassMap
71   - public static final Obf tileEntityClassToNameMap = new Obf("field_145853_j", "i" ); // TileEntity/classToNameMap
  57 + public static final Obf minecraftProfiler = new Obf("field_71424_I", "y" );
  58 + public static final Obf entityRenderMap = new Obf("field_78729_o", "k" );
  59 + public static final Obf reloadListeners = new Obf("field_110546_b", "d" );
  60 + public static final Obf networkManager = new Obf("field_147393_d", "d" );
  61 + public static final Obf registryObjects = new Obf("field_82596_a", "c" );
  62 + public static final Obf underlyingIntegerMap = new Obf("field_148759_a", "a" );
  63 + public static final Obf identityMap = new Obf("field_148749_a", "a" );
  64 + public static final Obf objectList = new Obf("field_148748_b", "b" );
  65 + public static final Obf mapSpecialRenderers = new Obf("field_147559_m", "m" );
  66 + public static final Obf tileEntityNameToClassMap = new Obf("field_145855_i", "f" );
  67 + public static final Obf tileEntityClassToNameMap = new Obf("field_145853_j", "g" );
72 68  
73 69 // Methods
74 70 // -----------------------------------------------------------------------------------------
75 71 public static final Obf processPacket = new Obf("func_148833_a", "a" );
76   - public static final Obf runGameLoop = new Obf("func_71411_J", "ak" );
77   - public static final Obf runTick = new Obf("func_71407_l", "p" );
78   - public static final Obf updateCameraAndRender = new Obf("func_78480_b", "b" );
79   - public static final Obf renderWorld = new Obf("func_78471_a", "a" );
80   - public static final Obf renderGameOverlay = new Obf("func_73830_a", "a" );
81   - public static final Obf startSection = new Obf("func_76320_a", "a" );
82   - public static final Obf endSection = new Obf("func_76319_b", "b" );
83   - public static final Obf endStartSection = new Obf("func_76318_c", "c" );
84   - public static final Obf spawnPlayer = new Obf("func_148545_a", "a" );
  72 + public static final Obf runGameLoop = new Obf("func_71411_J", "as" );
  73 + public static final Obf runTick = new Obf("func_71407_l", "r" );
  74 + public static final Obf updateCameraAndRender = new Obf("func_78480_b", "b" );
  75 + public static final Obf renderWorld = new Obf("func_78471_a", "a" );
  76 + public static final Obf renderGameOverlay = new Obf("func_175180_a", "a" );
  77 + public static final Obf startSection = new Obf("func_76320_a", "a" );
  78 + public static final Obf endSection = new Obf("func_76319_b", "b" );
  79 + public static final Obf endStartSection = new Obf("func_76318_c", "c" );
  80 + public static final Obf spawnPlayer = new Obf("func_148545_a", "f" );
85 81 public static final Obf respawnPlayer = new Obf("func_72368_a", "a" );
86 82 public static final Obf initializeConnectionToPlayer = new Obf("func_72355_a", "a" );
87 83 public static final Obf playerLoggedIn = new Obf("func_72377_c", "c" );
88 84 public static final Obf playerLoggedOut = new Obf("func_72367_e", "e" );
89   - public static final Obf startGame = new Obf("func_71384_a", "ag" );
90   - public static final Obf startServer = new Obf("func_71197_b", "e" );
91   - public static final Obf startServerThread = new Obf("func_71256_s", "w" );
92   - public static final Obf sendChatMessage = new Obf("func_71165_d", "a" );
93   - public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "an" );
  85 + public static final Obf startGame = new Obf("func_71384_a", "aj" );
  86 + public static final Obf startServer = new Obf("func_71197_b", "i" );
  87 + public static final Obf startServerThread = new Obf("func_71256_s", "B" );
  88 + public static final Obf sendChatMessage = new Obf("func_71165_d", "e" );
  89 + public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "av" );
94 90 public static final Obf framebufferRender = new Obf("func_147615_c", "c" );
  91 + public static final Obf framebufferRenderExt = new Obf("func_178038_a", "a" );
95 92 public static final Obf bindFramebufferTexture = new Obf("func_147612_c", "c" );
96 93 public static final Obf drawChat = new Obf("func_146230_a", "a" );
  94 + public static final Obf clear = new Obf("func_179086_m", "m" );
  95 + public static final Obf renderWorldPass = new Obf("func_175068_a", "a" );
  96 + public static final Obf getProfile = new Obf("func_148256_e", "a" );
97 97  
98 98 public static final int MCP = 0;
99 99 public static final int SRG = 1;
100 100 public static final int OBF = 2;
101 101  
102 102 private static Properties mcpNames;
  103 +
  104 + private static final Map<String, Obf> obfs = new HashMap<String, Obf>();
  105 +
  106 + static
  107 + {
  108 + try
  109 + {
  110 + for (Field fd : Obf.class.getFields())
  111 + {
  112 + if (fd.getType().equals(Obf.class))
  113 + {
  114 + Obf.obfs.put(fd.getName(), (Obf)fd.get(null));
  115 + }
  116 + }
  117 + }
  118 + catch (IllegalAccessException ex) {}
  119 + }
103 120  
104 121 /**
105 122 * Array of names, indexed by MCP, SRG, OBF constants
... ... @@ -205,4 +222,13 @@ public class Obf
205 222  
206 223 return Obf.mcpNames.getProperty(seargeName, seargeName);
207 224 }
  225 +
  226 + /**
  227 + * @param name
  228 + * @return
  229 + */
  230 + public static Obf getByName(String name)
  231 + {
  232 + return Obf.obfs.get(name);
  233 + }
208 234 }
... ...
java/common/com/mumfrey/liteloader/core/runtime/Packets.java
1 1 package com.mumfrey.liteloader.core.runtime;
2 2  
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
3 6 /**
4 7 * Packet obfuscation table
5 8 *
6 9 * @author Adam Mummery-Smith
7   - * TODO Obfuscation 1.7.10
  10 + * TODO Obfuscation 1.8
8 11 */
9   -@SuppressWarnings("hiding")
10 12 public class Packets extends Obf
11 13 {
12   - public static final Packets S08PacketPlayerPosLook = new Packets("net.minecraft.network.play.server.S08PacketPlayerPosLook", "fu");
13   - public static final Packets S0EPacketSpawnObject = new Packets("net.minecraft.network.play.server.S0EPacketSpawnObject", "fw");
14   - public static final Packets S11PacketSpawnExperienceOrb = new Packets("net.minecraft.network.play.server.S11PacketSpawnExperienceOrb", "fx");
15   - public static final Packets S2CPacketSpawnGlobalEntity = new Packets("net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity", "fy");
16   - public static final Packets S0FPacketSpawnMob = new Packets("net.minecraft.network.play.server.S0FPacketSpawnMob", "fz");
17   - public static final Packets S10PacketSpawnPainting = new Packets("net.minecraft.network.play.server.S10PacketSpawnPainting", "ga");
18   - public static final Packets S0CPacketSpawnPlayer = new Packets("net.minecraft.network.play.server.S0CPacketSpawnPlayer", "gb");
19   - public static final Packets S0BPacketAnimation = new Packets("net.minecraft.network.play.server.S0BPacketAnimation", "gc");
20   - public static final Packets S37PacketStatistics = new Packets("net.minecraft.network.play.server.S37PacketStatistics", "gd");
21   - public static final Packets S25PacketBlockBreakAnim = new Packets("net.minecraft.network.play.server.S25PacketBlockBreakAnim", "ge");
22   - public static final Packets S35PacketUpdateTileEntity = new Packets("net.minecraft.network.play.server.S35PacketUpdateTileEntity", "gf");
23   - public static final Packets S24PacketBlockAction = new Packets("net.minecraft.network.play.server.S24PacketBlockAction", "gg");
24   - public static final Packets S23PacketBlockChange = new Packets("net.minecraft.network.play.server.S23PacketBlockChange", "gh");
25   - public static final Packets S3APacketTabComplete = new Packets("net.minecraft.network.play.server.S3APacketTabComplete", "gi");
26   - public static final Packets S02PacketChat = new Packets("net.minecraft.network.play.server.S02PacketChat", "gj");
27   - public static final Packets S22PacketMultiBlockChange = new Packets("net.minecraft.network.play.server.S22PacketMultiBlockChange", "gk");
28   - public static final Packets S32PacketConfirmTransaction = new Packets("net.minecraft.network.play.server.S32PacketConfirmTransaction", "gl");
29   - public static final Packets S2EPacketCloseWindow = new Packets("net.minecraft.network.play.server.S2EPacketCloseWindow", "gm");
30   - public static final Packets S2DPacketOpenWindow = new Packets("net.minecraft.network.play.server.S2DPacketOpenWindow", "gn");
31   - public static final Packets S30PacketWindowItems = new Packets("net.minecraft.network.play.server.S30PacketWindowItems", "go");
32   - public static final Packets S31PacketWindowProperty = new Packets("net.minecraft.network.play.server.S31PacketWindowProperty", "gp");
33   - public static final Packets S2FPacketSetSlot = new Packets("net.minecraft.network.play.server.S2FPacketSetSlot", "gq");
34   - public static final Packets S3FPacketCustomPayload = new Packets("net.minecraft.network.play.server.S3FPacketCustomPayload", "gr");
35   - public static final Packets S40PacketDisconnect = new Packets("net.minecraft.network.play.server.S40PacketDisconnect", "gs");
36   - public static final Packets S19PacketEntityStatus = new Packets("net.minecraft.network.play.server.S19PacketEntityStatus", "gt");
37   - public static final Packets S27PacketExplosion = new Packets("net.minecraft.network.play.server.S27PacketExplosion", "gu");
38   - public static final Packets S2BPacketChangeGameState = new Packets("net.minecraft.network.play.server.S2BPacketChangeGameState", "gv");
39   - public static final Packets S00PacketKeepAlive = new Packets("net.minecraft.network.play.server.S00PacketKeepAlive", "gw");
40   - public static final Packets S21PacketChunkData = new Packets("net.minecraft.network.play.server.S21PacketChunkData", "gx");
41   - public static final Packets S21PacketChunkData$Extracted = new Packets("net.minecraft.network.play.server.S21PacketChunkData$Extracted", "gy");
42   - public static final Packets S26PacketMapChunkBulk = new Packets("net.minecraft.network.play.server.S26PacketMapChunkBulk", "gz");
43   - public static final Packets S28PacketEffect = new Packets("net.minecraft.network.play.server.S28PacketEffect", "ha");
44   - public static final Packets S2APacketParticles = new Packets("net.minecraft.network.play.server.S2APacketParticles", "hb");
45   - public static final Packets S29PacketSoundEffect = new Packets("net.minecraft.network.play.server.S29PacketSoundEffect", "hc");
46   - public static final Packets S01PacketJoinGame = new Packets("net.minecraft.network.play.server.S01PacketJoinGame", "hd");
47   - public static final Packets S34PacketMaps = new Packets("net.minecraft.network.play.server.S34PacketMaps", "he");
48   - public static final Packets S14PacketEntity = new Packets("net.minecraft.network.play.server.S14PacketEntity", "hf");
49   - public static final Packets S15PacketEntityRelMove = new Packets("net.minecraft.network.play.server.S14PacketEntity$S15PacketEntityRelMove", "hg");
50   - public static final Packets S17PacketEntityLookMove = new Packets("net.minecraft.network.play.server.S14PacketEntity$S17PacketEntityLookMove", "hh");
51   - public static final Packets S16PacketEntityLook = new Packets("net.minecraft.network.play.server.S14PacketEntity$S16PacketEntityLook", "hi");
52   - public static final Packets S36PacketSignEditorOpen = new Packets("net.minecraft.network.play.server.S36PacketSignEditorOpen", "hj");
53   - public static final Packets S39PacketPlayerAbilities = new Packets("net.minecraft.network.play.server.S39PacketPlayerAbilities", "hk");
54   - public static final Packets S38PacketPlayerListItem = new Packets("net.minecraft.network.play.server.S38PacketPlayerListItem", "ho");
55   - public static final Packets S0APacketUseBed = new Packets("net.minecraft.network.play.server.S0APacketUseBed", "hp");
56   - public static final Packets S13PacketDestroyEntities = new Packets("net.minecraft.network.play.server.S13PacketDestroyEntities", "hq");
57   - public static final Packets S1EPacketRemoveEntityEffect = new Packets("net.minecraft.network.play.server.S1EPacketRemoveEntityEffect", "hr");
58   - public static final Packets S07PacketRespawn = new Packets("net.minecraft.network.play.server.S07PacketRespawn", "hs");
59   - public static final Packets S19PacketEntityHeadLook = new Packets("net.minecraft.network.play.server.S19PacketEntityHeadLook", "ht");
60   - public static final Packets S09PacketHeldItemChange = new Packets("net.minecraft.network.play.server.S09PacketHeldItemChange", "hu");
61   - public static final Packets S3DPacketDisplayScoreboard = new Packets("net.minecraft.network.play.server.S3DPacketDisplayScoreboard", "hv");
62   - public static final Packets S1CPacketEntityMetadata = new Packets("net.minecraft.network.play.server.S1CPacketEntityMetadata", "hw");
63   - public static final Packets S1BPacketEntityAttach = new Packets("net.minecraft.network.play.server.S1BPacketEntityAttach", "hx");
64   - public static final Packets S12PacketEntityVelocity = new Packets("net.minecraft.network.play.server.S12PacketEntityVelocity", "hy");
65   - public static final Packets S04PacketEntityEquipment = new Packets("net.minecraft.network.play.server.S04PacketEntityEquipment", "hz");
66   - public static final Packets S1FPacketSetExperience = new Packets("net.minecraft.network.play.server.S1FPacketSetExperience", "ia");
67   - public static final Packets S06PacketUpdateHealth = new Packets("net.minecraft.network.play.server.S06PacketUpdateHealth", "ib");
68   - public static final Packets S3BPacketScoreboardObjective = new Packets("net.minecraft.network.play.server.S3BPacketScoreboardObjective", "ic");
69   - public static final Packets S3EPacketTeams = new Packets("net.minecraft.network.play.server.S3EPacketTeams", "id");
70   - public static final Packets S3CPacketUpdateScore = new Packets("net.minecraft.network.play.server.S3CPacketUpdateScore", "ie");
71   - public static final Packets S05PacketSpawnPosition = new Packets("net.minecraft.network.play.server.S05PacketSpawnPosition", "ig");
72   - public static final Packets S03PacketTimeUpdate = new Packets("net.minecraft.network.play.server.S03PacketTimeUpdate", "ih");
73   - public static final Packets S33PacketUpdateSign = new Packets("net.minecraft.network.play.server.S33PacketUpdateSign", "ii");
74   - public static final Packets S0DPacketCollectItem = new Packets("net.minecraft.network.play.server.S0DPacketCollectItem", "ij");
75   - public static final Packets S18PacketEntityTeleport = new Packets("net.minecraft.network.play.server.S18PacketEntityTeleport", "ik");
76   - public static final Packets S20PacketEntityProperties = new Packets("net.minecraft.network.play.server.S20PacketEntityProperties", "il");
77   - public static final Packets S20PacketEntityProperties$Snapshot = new Packets("net.minecraft.network.play.server.S20PacketEntityProperties$Snapshot", "im");
78   - public static final Packets S1DPacketEntityEffect = new Packets("net.minecraft.network.play.server.S1DPacketEntityEffect", "in");
79   - public static final Packets C0APacketAnimation = new Packets("net.minecraft.network.play.client.C0APacketAnimation", "ip");
80   - public static final Packets C14PacketTabComplete = new Packets("net.minecraft.network.play.client.C14PacketTabComplete", "iq");
81   - public static final Packets C01PacketChatMessage = new Packets("net.minecraft.network.play.client.C01PacketChatMessage", "ir");
82   - public static final Packets C16PacketClientStatus = new Packets("net.minecraft.network.play.client.C16PacketClientStatus", "is");
83   - public static final Packets C16PacketClientStatus$EnumState = new Packets("net.minecraft.network.play.client.C16PacketClientStatus$EnumState", "it");
84   - public static final Packets C15PacketClientSettings = new Packets("net.minecraft.network.play.client.C15PacketClientSettings", "iu");
85   - public static final Packets C0FPacketConfirmTransaction = new Packets("net.minecraft.network.play.client.C0FPacketConfirmTransaction", "iv");
86   - public static final Packets C11PacketEnchantItem = new Packets("net.minecraft.network.play.client.C11PacketEnchantItem", "iw");
87   - public static final Packets C0EPacketClickWindow = new Packets("net.minecraft.network.play.client.C0EPacketClickWindow", "ix");
88   - public static final Packets C0DPacketCloseWindow = new Packets("net.minecraft.network.play.client.C0DPacketCloseWindow", "iy");
89   - public static final Packets C17PacketCustomPayload = new Packets("net.minecraft.network.play.client.C17PacketCustomPayload", "iz");
90   - public static final Packets C02PacketUseEntity = new Packets("net.minecraft.network.play.client.C02PacketUseEntity", "ja");
91   - public static final Packets C02PacketUseEntity$Action = new Packets("net.minecraft.network.play.client.C02PacketUseEntity$Action", "jb");
92   - public static final Packets C00PacketKeepAlive = new Packets("net.minecraft.network.play.client.C00PacketKeepAlive", "jc");
93   - public static final Packets C03PacketPlayer = new Packets("net.minecraft.network.play.client.C03PacketPlayer", "jd");
94   - public static final Packets C04PacketPlayerPosition = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition", "je");
95   - public static final Packets C06PacketPlayerPosLook = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook", "jf");
96   - public static final Packets C05PacketPlayerLook = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C05PacketPlayerLook", "jg");
97   - public static final Packets C13PacketPlayerAbilities = new Packets("net.minecraft.network.play.client.C13PacketPlayerAbilities", "jh");
98   - public static final Packets C07PacketPlayerDigging = new Packets("net.minecraft.network.play.client.C07PacketPlayerDigging", "ji");
99   - public static final Packets C0BPacketEntityAction = new Packets("net.minecraft.network.play.client.C0BPacketEntityAction", "jj");
100   - public static final Packets C0CPacketInput = new Packets("net.minecraft.network.play.client.C0CPacketInput", "jk");
101   - public static final Packets C09PacketHeldItemChange = new Packets("net.minecraft.network.play.client.C09PacketHeldItemChange", "jl");
102   - public static final Packets C10PacketCreativeInventoryAction = new Packets("net.minecraft.network.play.client.C10PacketCreativeInventoryAction", "jm");
103   - public static final Packets C12PacketUpdateSign = new Packets("net.minecraft.network.play.client.C12PacketUpdateSign", "jn");
104   - public static final Packets C08PacketPlayerBlockPlacement = new Packets("net.minecraft.network.play.client.C08PacketPlayerBlockPlacement", "jo");
105   - public static final Packets C00Handshake = new Packets("net.minecraft.network.handshake.client.C00Handshake", "jp");
106   - public static final Packets S02PacketLoginSuccess = new Packets("net.minecraft.network.login.server.S02PacketLoginSuccess", "js");
107   - public static final Packets S01PacketEncryptionRequest = new Packets("net.minecraft.network.login.server.S01PacketEncryptionRequest", "jt");
108   - public static final Packets S00PacketDisconnect = new Packets("net.minecraft.network.login.server.S00PacketDisconnect", "ju");
109   - public static final Packets C00PacketLoginStart = new Packets("net.minecraft.network.login.client.C00PacketLoginStart", "jw");
110   - public static final Packets C01PacketEncryptionResponse = new Packets("net.minecraft.network.login.client.C01PacketEncryptionResponse", "jx");
111   - public static final Packets S01PacketPong = new Packets("net.minecraft.network.status.server.S01PacketPong", "jz");
112   - public static final Packets S00PacketServerInfo = new Packets("net.minecraft.network.status.server.S00PacketServerInfo", "ka");
  14 + private static Map<String, Packets> packetMap = new HashMap<String, Packets>();
  15 +
  16 + public static Packets S08PacketPlayerPosLook = new Packets("net.minecraft.network.play.server.S08PacketPlayerPosLook", "ii");
  17 + public static Packets S0EPacketSpawnObject = new Packets("net.minecraft.network.play.server.S0EPacketSpawnObject", "il");
  18 + public static Packets S11PacketSpawnExperienceOrb = new Packets("net.minecraft.network.play.server.S11PacketSpawnExperienceOrb", "im");
  19 + public static Packets S2CPacketSpawnGlobalEntity = new Packets("net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity", "in");
  20 + public static Packets S0FPacketSpawnMob = new Packets("net.minecraft.network.play.server.S0FPacketSpawnMob", "io");
  21 + public static Packets S10PacketSpawnPainting = new Packets("net.minecraft.network.play.server.S10PacketSpawnPainting", "ip");
  22 + public static Packets S0CPacketSpawnPlayer = new Packets("net.minecraft.network.play.server.S0CPacketSpawnPlayer", "iq");
  23 + public static Packets S0BPacketAnimation = new Packets("net.minecraft.network.play.server.S0BPacketAnimation", "ir");
  24 + public static Packets S37PacketStatistics = new Packets("net.minecraft.network.play.server.S37PacketStatistics", "is");
  25 + public static Packets S25PacketBlockBreakAnim = new Packets("net.minecraft.network.play.server.S25PacketBlockBreakAnim", "it");
  26 + public static Packets S35PacketUpdateTileEntity = new Packets("net.minecraft.network.play.server.S35PacketUpdateTileEntity", "iu");
  27 + public static Packets S24PacketBlockAction = new Packets("net.minecraft.network.play.server.S24PacketBlockAction", "iv");
  28 + public static Packets S23PacketBlockChange = new Packets("net.minecraft.network.play.server.S23PacketBlockChange", "iw");
  29 + public static Packets S41PacketServerDifficulty = new Packets("net.minecraft.network.play.server.S41PacketServerDifficulty", "ix");
  30 + public static Packets S3APacketTabComplete = new Packets("net.minecraft.network.play.server.S3APacketTabComplete", "iy");
  31 + public static Packets S02PacketChat = new Packets("net.minecraft.network.play.server.S02PacketChat", "iz");
  32 + public static Packets S22PacketMultiBlockChange = new Packets("net.minecraft.network.play.server.S22PacketMultiBlockChange", "ja");
  33 + public static Packets S32PacketConfirmTransaction = new Packets("net.minecraft.network.play.server.S32PacketConfirmTransaction", "jc");
  34 + public static Packets S2EPacketCloseWindow = new Packets("net.minecraft.network.play.server.S2EPacketCloseWindow", "jd");
  35 + public static Packets S2DPacketOpenWindow = new Packets("net.minecraft.network.play.server.S2DPacketOpenWindow", "je");
  36 + public static Packets S30PacketWindowItems = new Packets("net.minecraft.network.play.server.S30PacketWindowItems", "jf");
  37 + public static Packets S31PacketWindowProperty = new Packets("net.minecraft.network.play.server.S31PacketWindowProperty", "jg");
  38 + public static Packets S2FPacketSetSlot = new Packets("net.minecraft.network.play.server.S2FPacketSetSlot", "jh");
  39 + public static Packets S3FPacketCustomPayload = new Packets("net.minecraft.network.play.server.S3FPacketCustomPayload", "ji");
  40 + public static Packets S40PacketDisconnect = new Packets("net.minecraft.network.play.server.S40PacketDisconnect", "jj");
  41 + public static Packets S19PacketEntityStatus = new Packets("net.minecraft.network.play.server.S19PacketEntityStatus", "jk");
  42 + public static Packets S49PacketUpdateEntityNBT = new Packets("net.minecraft.network.play.server.S49PacketUpdateEntityNBT", "jl");
  43 + public static Packets S27PacketExplosion = new Packets("net.minecraft.network.play.server.S27PacketExplosion", "jm");
  44 + public static Packets S46PacketSetCompressionLevel = new Packets("net.minecraft.network.play.server.S46PacketSetCompressionLevel", "jn");
  45 + public static Packets S2BPacketChangeGameState = new Packets("net.minecraft.network.play.server.S2BPacketChangeGameState", "jo");
  46 + public static Packets S00PacketKeepAlive = new Packets("net.minecraft.network.play.server.S00PacketKeepAlive", "jp");
  47 + public static Packets S21PacketChunkData = new Packets("net.minecraft.network.play.server.S21PacketChunkData", "jq");
  48 + public static Packets S26PacketMapChunkBulk = new Packets("net.minecraft.network.play.server.S26PacketMapChunkBulk", "js");
  49 + public static Packets S28PacketEffect = new Packets("net.minecraft.network.play.server.S28PacketEffect", "jt");
  50 + public static Packets S2APacketParticles = new Packets("net.minecraft.network.play.server.S2APacketParticles", "ju");
  51 + public static Packets S29PacketSoundEffect = new Packets("net.minecraft.network.play.server.S29PacketSoundEffect", "jv");
  52 + public static Packets S01PacketJoinGame = new Packets("net.minecraft.network.play.server.S01PacketJoinGame", "jw");
  53 + public static Packets S34PacketMaps = new Packets("net.minecraft.network.play.server.S34PacketMaps", "jx");
  54 + public static Packets S14PacketEntity = new Packets("net.minecraft.network.play.server.S14PacketEntity", "jy");
  55 + public static Packets S15PacketEntityRelMove = new Packets("net.minecraft.network.play.server.S14PacketEntity$S15PacketEntityRelMove", "jz");
  56 + public static Packets S17PacketEntityLookMove = new Packets("net.minecraft.network.play.server.S14PacketEntity$S17PacketEntityLookMove", "ka");
  57 + public static Packets S16PacketEntityLook = new Packets("net.minecraft.network.play.server.S14PacketEntity$S16PacketEntityLook", "kb");
  58 + public static Packets S36PacketSignEditorOpen = new Packets("net.minecraft.network.play.server.S36PacketSignEditorOpen", "kc");
  59 + public static Packets S39PacketPlayerAbilities = new Packets("net.minecraft.network.play.server.S39PacketPlayerAbilities", "kd");
  60 + public static Packets S42PacketCombatEvent = new Packets("net.minecraft.network.play.server.S42PacketCombatEvent", "ke");
  61 + public static Packets S38PacketPlayerListItem = new Packets("net.minecraft.network.play.server.S38PacketPlayerListItem", "kh");
  62 + public static Packets S0APacketUseBed = new Packets("net.minecraft.network.play.server.S0APacketUseBed", "kl");
  63 + public static Packets S13PacketDestroyEntities = new Packets("net.minecraft.network.play.server.S13PacketDestroyEntities", "km");
  64 + public static Packets S1EPacketRemoveEntityEffect = new Packets("net.minecraft.network.play.server.S1EPacketRemoveEntityEffect", "kn");
  65 + public static Packets S48PacketResourcePackSend = new Packets("net.minecraft.network.play.server.S48PacketResourcePackSend", "ko");
  66 + public static Packets S07PacketRespawn = new Packets("net.minecraft.network.play.server.S07PacketRespawn", "kp");
  67 + public static Packets S19PacketEntityHeadLook = new Packets("net.minecraft.network.play.server.S19PacketEntityHeadLook", "kq");
  68 + public static Packets S44PacketWorldBorder = new Packets("net.minecraft.network.play.server.S44PacketWorldBorder", "kr");
  69 + public static Packets S43PacketCamera = new Packets("net.minecraft.network.play.server.S43PacketCamera", "ku");
  70 + public static Packets S09PacketHeldItemChange = new Packets("net.minecraft.network.play.server.S09PacketHeldItemChange", "kv");
  71 + public static Packets S3DPacketDisplayScoreboard = new Packets("net.minecraft.network.play.server.S3DPacketDisplayScoreboard", "kw");
  72 + public static Packets S1CPacketEntityMetadata = new Packets("net.minecraft.network.play.server.S1CPacketEntityMetadata", "kx");
  73 + public static Packets S1BPacketEntityAttach = new Packets("net.minecraft.network.play.server.S1BPacketEntityAttach", "ky");
  74 + public static Packets S12PacketEntityVelocity = new Packets("net.minecraft.network.play.server.S12PacketEntityVelocity", "kz");
  75 + public static Packets S04PacketEntityEquipment = new Packets("net.minecraft.network.play.server.S04PacketEntityEquipment", "la");
  76 + public static Packets S1FPacketSetExperience = new Packets("net.minecraft.network.play.server.S1FPacketSetExperience", "lb");
  77 + public static Packets S06PacketUpdateHealth = new Packets("net.minecraft.network.play.server.S06PacketUpdateHealth", "lc");
  78 + public static Packets S3BPacketScoreboardObjective = new Packets("net.minecraft.network.play.server.S3BPacketScoreboardObjective", "ld");
  79 + public static Packets S3EPacketTeams = new Packets("net.minecraft.network.play.server.S3EPacketTeams", "le");
  80 + public static Packets S3CPacketUpdateScore = new Packets("net.minecraft.network.play.server.S3CPacketUpdateScore", "lf");
  81 + public static Packets S05PacketSpawnPosition = new Packets("net.minecraft.network.play.server.S05PacketSpawnPosition", "lh");
  82 + public static Packets S03PacketTimeUpdate = new Packets("net.minecraft.network.play.server.S03PacketTimeUpdate", "li");
  83 + public static Packets S45PacketTitle = new Packets("net.minecraft.network.play.server.S45PacketTitle", "lj");
  84 + public static Packets S33PacketUpdateSign = new Packets("net.minecraft.network.play.server.S33PacketUpdateSign", "ll");
  85 + public static Packets S47PacketPlayerListHeaderFooter = new Packets("net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter", "lm");
  86 + public static Packets S0DPacketCollectItem = new Packets("net.minecraft.network.play.server.S0DPacketCollectItem", "ln");
  87 + public static Packets S18PacketEntityTeleport = new Packets("net.minecraft.network.play.server.S18PacketEntityTeleport", "lo");
  88 + public static Packets S20PacketEntityProperties = new Packets("net.minecraft.network.play.server.S20PacketEntityProperties", "lp");
  89 + public static Packets S1DPacketEntityEffect = new Packets("net.minecraft.network.play.server.S1DPacketEntityEffect", "lr");
  90 + public static Packets C14PacketTabComplete = new Packets("net.minecraft.network.play.client.C14PacketTabComplete", "lt");
  91 + public static Packets C01PacketChatMessage = new Packets("net.minecraft.network.play.client.C01PacketChatMessage", "lu");
  92 + public static Packets C16PacketClientStatus = new Packets("net.minecraft.network.play.client.C16PacketClientStatus", "lv");
  93 + public static Packets C15PacketClientSettings = new Packets("net.minecraft.network.play.client.C15PacketClientSettings", "lx");
  94 + public static Packets C0FPacketConfirmTransaction = new Packets("net.minecraft.network.play.client.C0FPacketConfirmTransaction", "ly");
  95 + public static Packets C11PacketEnchantItem = new Packets("net.minecraft.network.play.client.C11PacketEnchantItem", "lz");
  96 + public static Packets C0EPacketClickWindow = new Packets("net.minecraft.network.play.client.C0EPacketClickWindow", "ma");
  97 + public static Packets C0DPacketCloseWindow = new Packets("net.minecraft.network.play.client.C0DPacketCloseWindow", "mb");
  98 + public static Packets C17PacketCustomPayload = new Packets("net.minecraft.network.play.client.C17PacketCustomPayload", "mc");
  99 + public static Packets C02PacketUseEntity = new Packets("net.minecraft.network.play.client.C02PacketUseEntity", "md");
  100 + public static Packets C00PacketKeepAlive = new Packets("net.minecraft.network.play.client.C00PacketKeepAlive", "mf");
  101 + public static Packets C03PacketPlayer = new Packets("net.minecraft.network.play.client.C03PacketPlayer", "mg");
  102 + public static Packets C04PacketPlayerPosition = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition", "mh");
  103 + public static Packets C06PacketPlayerPosLook = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook", "mi");
  104 + public static Packets C05PacketPlayerLook = new Packets("net.minecraft.network.play.client.C03PacketPlayer$C05PacketPlayerLook", "mj");
  105 + public static Packets C13PacketPlayerAbilities = new Packets("net.minecraft.network.play.client.C13PacketPlayerAbilities", "mk");
  106 + public static Packets C07PacketPlayerDigging = new Packets("net.minecraft.network.play.client.C07PacketPlayerDigging", "ml");
  107 + public static Packets C0BPacketEntityAction = new Packets("net.minecraft.network.play.client.C0BPacketEntityAction", "mn");
  108 + public static Packets C0CPacketInput = new Packets("net.minecraft.network.play.client.C0CPacketInput", "mp");
  109 + public static Packets C19PacketResourcePackStatus = new Packets("net.minecraft.network.play.client.C19PacketResourcePackStatus", "mq");
  110 + public static Packets C09PacketHeldItemChange = new Packets("net.minecraft.network.play.client.C09PacketHeldItemChange", "ms");
  111 + public static Packets C10PacketCreativeInventoryAction = new Packets("net.minecraft.network.play.client.C10PacketCreativeInventoryAction", "mt");
  112 + public static Packets C12PacketUpdateSign = new Packets("net.minecraft.network.play.client.C12PacketUpdateSign", "mu");
  113 + public static Packets C0APacketAnimation = new Packets("net.minecraft.network.play.client.C0APacketAnimation", "mv");
  114 + public static Packets C18PacketSpectate = new Packets("net.minecraft.network.play.client.C18PacketSpectate", "mw");
  115 + public static Packets C08PacketPlayerBlockPlacement = new Packets("net.minecraft.network.play.client.C08PacketPlayerBlockPlacement", "mx");
  116 + public static Packets C00Handshake = new Packets("net.minecraft.network.handshake.client.C00Handshake", "mz");
  117 + public static Packets S02PacketLoginSuccess = new Packets("net.minecraft.network.login.server.S02PacketLoginSuccess", "nd");
  118 + public static Packets S01PacketEncryptionRequest = new Packets("net.minecraft.network.login.server.S01PacketEncryptionRequest", "ne");
  119 + public static Packets S03PacketEnableCompression = new Packets("net.minecraft.network.login.server.S03PacketEnableCompression", "nf");
  120 + public static Packets S00PacketDisconnect = new Packets("net.minecraft.network.login.server.S00PacketDisconnect", "ng");
  121 + public static Packets C00PacketLoginStart = new Packets("net.minecraft.network.login.client.C00PacketLoginStart", "ni");
  122 + public static Packets C01PacketEncryptionResponse = new Packets("net.minecraft.network.login.client.C01PacketEncryptionResponse", "nj");
  123 + public static Packets S01PacketPong = new Packets("net.minecraft.network.status.server.S01PacketPong", "nn");
  124 + public static Packets S00PacketServerInfo = new Packets("net.minecraft.network.status.server.S00PacketServerInfo", "no");
  125 + public static Packets C01PacketPing = new Packets("net.minecraft.network.status.client.C01PacketPing", "nw");
  126 + public static Packets C00PacketServerQuery = new Packets("net.minecraft.network.status.client.C00PacketServerQuery", "nx");
113 127  
114 128 public static final Packets[] packets = new Packets[] {
115 129 S08PacketPlayerPosLook,
... ... @@ -125,6 +139,7 @@ public class Packets extends Obf
125 139 S35PacketUpdateTileEntity,
126 140 S24PacketBlockAction,
127 141 S23PacketBlockChange,
  142 + S41PacketServerDifficulty,
128 143 S3APacketTabComplete,
129 144 S02PacketChat,
130 145 S22PacketMultiBlockChange,
... ... @@ -137,11 +152,12 @@ public class Packets extends Obf
137 152 S3FPacketCustomPayload,
138 153 S40PacketDisconnect,
139 154 S19PacketEntityStatus,
  155 + S49PacketUpdateEntityNBT,
140 156 S27PacketExplosion,
  157 + S46PacketSetCompressionLevel,
141 158 S2BPacketChangeGameState,
142 159 S00PacketKeepAlive,
143 160 S21PacketChunkData,
144   - S21PacketChunkData$Extracted,
145 161 S26PacketMapChunkBulk,
146 162 S28PacketEffect,
147 163 S2APacketParticles,
... ... @@ -154,12 +170,16 @@ public class Packets extends Obf
154 170 S16PacketEntityLook,
155 171 S36PacketSignEditorOpen,
156 172 S39PacketPlayerAbilities,
  173 + S42PacketCombatEvent,
157 174 S38PacketPlayerListItem,
158 175 S0APacketUseBed,
159 176 S13PacketDestroyEntities,
160 177 S1EPacketRemoveEntityEffect,
  178 + S48PacketResourcePackSend,
161 179 S07PacketRespawn,
162 180 S19PacketEntityHeadLook,
  181 + S44PacketWorldBorder,
  182 + S43PacketCamera,
163 183 S09PacketHeldItemChange,
164 184 S3DPacketDisplayScoreboard,
165 185 S1CPacketEntityMetadata,
... ... @@ -173,17 +193,16 @@ public class Packets extends Obf
173 193 S3CPacketUpdateScore,
174 194 S05PacketSpawnPosition,
175 195 S03PacketTimeUpdate,
  196 + S45PacketTitle,
176 197 S33PacketUpdateSign,
  198 + S47PacketPlayerListHeaderFooter,
177 199 S0DPacketCollectItem,
178 200 S18PacketEntityTeleport,
179 201 S20PacketEntityProperties,
180   - S20PacketEntityProperties$Snapshot,
181 202 S1DPacketEntityEffect,
182   - C0APacketAnimation,
183 203 C14PacketTabComplete,
184 204 C01PacketChatMessage,
185 205 C16PacketClientStatus,
186   - C16PacketClientStatus$EnumState,
187 206 C15PacketClientSettings,
188 207 C0FPacketConfirmTransaction,
189 208 C11PacketEnchantItem,
... ... @@ -191,7 +210,6 @@ public class Packets extends Obf
191 210 C0DPacketCloseWindow,
192 211 C17PacketCustomPayload,
193 212 C02PacketUseEntity,
194   - C02PacketUseEntity$Action,
195 213 C00PacketKeepAlive,
196 214 C03PacketPlayer,
197 215 C04PacketPlayerPosition,
... ... @@ -201,18 +219,24 @@ public class Packets extends Obf
201 219 C07PacketPlayerDigging,
202 220 C0BPacketEntityAction,
203 221 C0CPacketInput,
  222 + C19PacketResourcePackStatus,
204 223 C09PacketHeldItemChange,
205 224 C10PacketCreativeInventoryAction,
206 225 C12PacketUpdateSign,
  226 + C0APacketAnimation,
  227 + C18PacketSpectate,
207 228 C08PacketPlayerBlockPlacement,
208 229 C00Handshake,
209 230 S02PacketLoginSuccess,
210 231 S01PacketEncryptionRequest,
  232 + S03PacketEnableCompression,
211 233 S00PacketDisconnect,
212 234 C00PacketLoginStart,
213 235 C01PacketEncryptionResponse,
214 236 S01PacketPong,
215   - S00PacketServerInfo
  237 + S00PacketServerInfo,
  238 + C01PacketPing,
  239 + C00PacketServerQuery,
216 240 };
217 241  
218 242 private static int nextPacketIndex;
... ... @@ -227,6 +251,7 @@ public class Packets extends Obf
227 251  
228 252 this.shortName = seargeName.substring(Math.max(seargeName.lastIndexOf('.'), seargeName.lastIndexOf('$')) + 1);
229 253 this.index = Packets.nextPacketIndex++;
  254 + Packets.packetMap.put(this.shortName, this);
230 255 }
231 256  
232 257 public int getIndex()
... ... @@ -253,4 +278,13 @@ public class Packets extends Obf
253 278 {
254 279 return Packets.nextPacketIndex;
255 280 }
  281 +
  282 + /**
  283 + * @param name
  284 + * @return
  285 + */
  286 + public static Packets getByName(String name)
  287 + {
  288 + return Packets.packetMap.get(name);
  289 + }
256 290 }
... ...
java/common/com/mumfrey/liteloader/crashreport/CallableLiteLoaderBrand.java
... ... @@ -21,7 +21,15 @@ public class CallableLiteLoaderBrand implements Callable&lt;String&gt;
21 21 @Override
22 22 public String call() throws Exception
23 23 {
24   - String brand = LiteLoader.getBranding();
  24 + String brand = null;
  25 + try
  26 + {
  27 + brand = LiteLoader.getBranding();
  28 + }
  29 + catch (Exception ex)
  30 + {
  31 + brand = "LiteLoader startup failed";
  32 + }
25 33 return brand == null ? "Unknown / None" : brand;
26 34 }
27 35 }
... ...
java/common/com/mumfrey/liteloader/crashreport/CallableLiteLoaderMods.java
... ... @@ -21,6 +21,13 @@ public class CallableLiteLoaderMods implements Callable&lt;String&gt;
21 21 @Override
22 22 public String call() throws Exception
23 23 {
24   - return LiteLoader.getInstance().getLoadedModsList();
  24 + try
  25 + {
  26 + return LiteLoader.getInstance().getLoadedModsList();
  27 + }
  28 + catch (Exception ex)
  29 + {
  30 + return "LiteLoader startup failed";
  31 + }
25 32 }
26 33 }
... ...
java/common/com/mumfrey/liteloader/interfaces/LoaderEnumerator.java
... ... @@ -14,6 +14,14 @@ import com.mumfrey.liteloader.core.ModInfo;
14 14 */
15 15 public interface LoaderEnumerator extends ModularEnumerator
16 16 {
  17 + public enum DisabledReason
  18 + {
  19 + UNKNOWN,
  20 + USER_DISABLED,
  21 + MISSING_DEPENDENCY,
  22 + MISSING_API
  23 + }
  24 +
17 25 /**
18 26 * Perform pre-init tasks (container discovery)
19 27 */
... ...
java/common/com/mumfrey/liteloader/launch/ClassTransformerManager.java
... ... @@ -12,7 +12,6 @@ import net.minecraft.launchwrapper.IClassTransformer;
12 12 import net.minecraft.launchwrapper.LaunchClassLoader;
13 13 import net.minecraft.launchwrapper.LogWrapper;
14 14  
15   -import com.mumfrey.liteloader.transformers.PacketTransformer;
16 15 import com.mumfrey.liteloader.util.SortableValue;
17 16 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
18 17  
... ... @@ -155,8 +154,6 @@ public class ClassTransformerManager
155 154 */
156 155 void injectUpstreamTransformers(LaunchClassLoader classLoader)
157 156 {
158   - this.sieveAndSortPacketTransformers(classLoader, this.pendingTransformers);
159   -
160 157 for (String requiredTransformerClassName : this.requiredTransformers)
161 158 {
162 159 LiteLoaderLogger.info("Injecting required class transformer '%s'", requiredTransformerClassName);
... ... @@ -197,84 +194,28 @@ public class ClassTransformerManager
197 194 this.gameStarted = true;
198 195 }
199 196  
200   - /**
201   - * Sieves packet transformers from the injected transformers list and pokes the rest into the downstreamTransformers set
202   - *
203   - * @param classLoader
204   - * @param transformers
205   - */
206   - @SuppressWarnings({ "unchecked", "deprecation" })
207   - private void sieveAndSortPacketTransformers(LaunchClassLoader classLoader, Set<String> transformers)
  197 + private synchronized void injectTransformer(LaunchClassLoader classLoader, String transformerClassName)
208 198 {
209   - LiteLoaderLogger.info("Sorting registered packet transformers by priority");
210   - int registeredTransformers = 0;
211   -
212   - NonDelegatingClassLoader tempLoader = new NonDelegatingClassLoader(classLoader.getURLs(), this.getClass().getClassLoader());
213   - tempLoader.addDelegatedClassName("com.mumfrey.liteloader.core.transformers.PacketTransformer");
214   - tempLoader.addDelegatedClassName("com.mumfrey.liteloader.core.runtime.Obf");
215   - tempLoader.addDelegatedClassName("net.minecraft.launchwrapper.IClassTransformer");
216   - tempLoader.addDelegatedPackage("org.objectweb.asm.");
217   -
218   - Iterator<String> iter = transformers.iterator();
219   - while (iter.hasNext())
  199 + try
220 200 {
221   - String transformerClassName = iter.next();
222   - try
  201 + // Assign pendingTransformer so that logged errors during transformer init can be put in the map
  202 + this.pendingTransformer = transformerClassName;
  203 +
  204 + // Register the transformer
  205 + classLoader.registerTransformer(transformerClassName);
  206 +
  207 + // Unassign pending transformer now init is completed
  208 + this.pendingTransformer = null;
  209 +
  210 + // Check whether the transformer was successfully injected, look for it in the transformer list
  211 + if (this.findTransformer(classLoader, transformerClassName) != null)
223 212 {
224   - Class<IClassTransformer> transformerClass = (Class<IClassTransformer>)tempLoader.addAndLoadClass(transformerClassName);
225   -
226   - if (PacketTransformer.class.isAssignableFrom(transformerClass))
227   - {
228   - if (tempLoader.isValid())
229   - {
230   - PacketTransformer transformer = (PacketTransformer)transformerClass.newInstance();
231   - String packetClass = transformer.getPacketClass();
232   - if (!this.packetTransformers.containsKey(packetClass))
233   - this.packetTransformers.put(packetClass, new TreeSet<SortableValue<String>>());
234   - this.packetTransformers.get(packetClass).add(transformer.getInfo(transformerClassName));
235   - registeredTransformers++;
236   - iter.remove();
237   - }
238   - else
239   - {
240   - LiteLoaderLogger.warning("Packet transformer class '%s' references class '%s' which is not allowed. Packet transformers must not contain references to other classes", transformerClassName, tempLoader.getInvalidClassName());
241   - iter.remove();
242   - }
243   - }
244   - }
245   - catch (NoClassDefFoundError err)
246   - {
247   - LiteLoaderLogger.warning(err, "Packet transformer class '%s' references a missing class. This probably means it is out of date or missing a dependency.", transformerClassName);
248   - err.printStackTrace();
249   - iter.remove();
250   - }
251   - catch (Exception ex)
252   - {
253   - ex.printStackTrace();
  213 + this.injectedTransformers.add(transformerClassName);
254 214 }
255 215 }
256   -
257   - this.downstreamTransformers.addAll(transformers);
258   - transformers.clear();
259   -
260   - LiteLoaderLogger.info("Added %d packet transformer classes to the transformer list", registeredTransformers);
261   - }
262   -
263   - private synchronized void injectTransformer(LaunchClassLoader classLoader, String transformerClassName)
264   - {
265   - // Assign pendingTransformer so that logged errors during transformer init can be put in the map
266   - this.pendingTransformer = transformerClassName;
267   -
268   - // Register the transformer
269   - classLoader.registerTransformer(transformerClassName);
270   -
271   - // Unassign pending transformer now init is completed
272   - this.pendingTransformer = null;
273   -
274   - // Check whether the transformer was successfully injected, look for it in the transformer list
275   - if (this.findTransformer(classLoader, transformerClassName) != null)
  216 + catch (Throwable th)
276 217 {
277   - this.injectedTransformers.add(transformerClassName);
  218 + LiteLoaderLogger.severe(th, "Error injecting class transformer class %s", transformerClassName);
278 219 }
279 220 }
280 221  
... ...
java/common/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
... ... @@ -27,8 +27,8 @@ public class LiteLoaderTweaker implements ITweaker
27 27 public static final int ENV_TYPE_CLIENT = 0;
28 28 public static final int ENV_TYPE_DEDICATEDSERVER = 1;
29 29  
30   - // TODO Version - 1.7.10
31   - public static final String VERSION = "1.7.10";
  30 + // TODO Version - 1.8
  31 + public static final String VERSION = "1.8";
32 32  
33 33 protected static final String bootstrapClassName = "com.mumfrey.liteloader.core.LiteLoaderBootstrap";
34 34  
... ... @@ -226,8 +226,8 @@ public class LiteLoaderTweaker implements ITweaker
226 226 @Override
227 227 public void injectIntoClassLoader(LaunchClassLoader classLoader)
228 228 {
229   - classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Obf");
230   - classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Packets");
  229 +// classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Obf");
  230 +// classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Packets");
231 231  
232 232 this.transformerManager.injectUpstreamTransformers(classLoader);
233 233  
... ... @@ -292,7 +292,6 @@ public class LiteLoaderTweaker implements ITweaker
292 292 this.bootstrap = this.spawnBootstrap(LiteLoaderTweaker.bootstrapClassName, Launch.classLoader);
293 293  
294 294 this.transformerManager = new ClassTransformerManager(this.bootstrap.getRequiredTransformers());
295   - this.transformerManager.injectTransformers(this.bootstrap.getPacketTransformers());
296 295  
297 296 StartupState.PREPARE.completed();
298 297 }
... ...
java/common/com/mumfrey/liteloader/launch/LoaderBootstrap.java
... ... @@ -41,8 +41,6 @@ public interface LoaderBootstrap
41 41  
42 42 public abstract List<String> getRequiredDownstreamTransformers();
43 43  
44   - public abstract List<String> getPacketTransformers();
45   -
46 44 public abstract LoaderEnvironment getEnvironment();
47 45  
48 46 public abstract LoaderProperties getProperties();
... ...
java/common/com/mumfrey/liteloader/permissions/PermissionsManagerClient.java
1 1 package com.mumfrey.liteloader.permissions;
2 2  
  3 +import io.netty.buffer.Unpooled;
  4 +
3 5 import java.io.File;
4 6 import java.util.Arrays;
5 7 import java.util.HashMap;
... ... @@ -11,6 +13,7 @@ import java.util.TreeSet;
11 13  
12 14 import net.eq2online.permissions.ReplicatedPermissionsContainer;
13 15 import net.minecraft.network.INetHandler;
  16 +import net.minecraft.network.PacketBuffer;
14 17 import net.minecraft.network.play.server.S01PacketJoinGame;
15 18  
16 19 import com.mumfrey.liteloader.LiteMod;
... ... @@ -243,7 +246,9 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann
243 246 if (!query.modName.equals("all") || query.permissions.size() > 0)
244 247 {
245 248 byte[] data = query.getBytes();
246   - ClientPluginChannels.sendMessage(ReplicatedPermissionsContainer.CHANNEL, data, ChannelPolicy.DISPATCH_ALWAYS);
  249 + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
  250 + buffer.writeByteArray(data);
  251 + ClientPluginChannels.sendMessage(ReplicatedPermissionsContainer.CHANNEL, buffer, ChannelPolicy.DISPATCH_ALWAYS);
247 252 }
248 253 }
249 254 }
... ... @@ -306,7 +311,7 @@ public class PermissionsManagerClient implements PermissionsManager, PluginChann
306 311 * @see net.eq2online.permissions.PermissionsManager#onCustomPayload(java.lang.String, int, byte[])
307 312 */
308 313 @Override
309   - public void onCustomPayload(String channel, int length, byte[] data)
  314 + public void onCustomPayload(String channel, PacketBuffer data)
310 315 {
311 316 if (channel.equals(ReplicatedPermissionsContainer.CHANNEL) && !this.engine.isSinglePlayer())
312 317 {
... ...
java/common/com/mumfrey/liteloader/permissions/PermissionsManagerServer.java
... ... @@ -3,6 +3,7 @@ package com.mumfrey.liteloader.permissions;
3 3 import java.util.List;
4 4  
5 5 import net.minecraft.entity.player.EntityPlayerMP;
  6 +import net.minecraft.network.PacketBuffer;
6 7  
7 8 import com.mumfrey.liteloader.Permissible;
8 9 import com.mumfrey.liteloader.ServerPluginChannelListener;
... ... @@ -26,7 +27,7 @@ public class PermissionsManagerServer implements PermissionsManager, ServerPlugi
26 27 }
27 28  
28 29 @Override
29   - public void onCustomPayload(EntityPlayerMP sender, String channel, int length, byte[] data)
  30 + public void onCustomPayload(EntityPlayerMP sender, String channel, PacketBuffer data)
30 31 {
31 32 }
32 33  
... ...
java/common/com/mumfrey/liteloader/permissions/ServerPermissions.java
... ... @@ -4,6 +4,7 @@ import java.util.regex.Matcher;
4 4 import java.util.regex.Pattern;
5 5  
6 6 import net.eq2online.permissions.ReplicatedPermissionsContainer;
  7 +import net.minecraft.network.PacketBuffer;
7 8  
8 9  
9 10 /**
... ... @@ -48,12 +49,12 @@ public class ServerPermissions implements ReplicatedPermissions
48 49 /**
49 50 * @param data
50 51 */
51   - public ServerPermissions(byte[] data)
  52 + public ServerPermissions(PacketBuffer data)
52 53 {
53 54 this.createdTime = System.currentTimeMillis();
54 55 this.validUntil = this.createdTime + this.cacheTime;
55 56  
56   - ReplicatedPermissionsContainer response = ReplicatedPermissionsContainer.fromBytes(data);
  57 + ReplicatedPermissionsContainer response = ReplicatedPermissionsContainer.fromPacketBuffer(data);
57 58  
58 59 if (response != null)
59 60 {
... ...
java/common/com/mumfrey/liteloader/transformers/ByteCodeUtilities.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers;
  2 +
  3 +import java.lang.annotation.Annotation;
  4 +import java.util.Iterator;
  5 +import java.util.List;
  6 +
  7 +import org.objectweb.asm.Opcodes;
  8 +import org.objectweb.asm.Type;
  9 +import org.objectweb.asm.tree.AbstractInsnNode;
  10 +import org.objectweb.asm.tree.AnnotationNode;
  11 +import org.objectweb.asm.tree.ClassNode;
  12 +import org.objectweb.asm.tree.FieldNode;
  13 +import org.objectweb.asm.tree.FrameNode;
  14 +import org.objectweb.asm.tree.InsnList;
  15 +import org.objectweb.asm.tree.LocalVariableNode;
  16 +import org.objectweb.asm.tree.MethodNode;
  17 +import org.objectweb.asm.tree.VarInsnNode;
  18 +
  19 +public abstract class ByteCodeUtilities
  20 +{
  21 + private ByteCodeUtilities() {}
  22 +
  23 + public static void loadArgs(Type[] args, InsnList insns, int pos)
  24 + {
  25 + ByteCodeUtilities.loadArgs(args, insns, pos, -1);
  26 + }
  27 +
  28 + public static void loadArgs(Type[] args, InsnList insns, int start, int end)
  29 + {
  30 + for (Type type : args)
  31 + {
  32 + insns.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), start));
  33 + start += type.getSize();
  34 + if (end >= start && start >= end) return;
  35 + }
  36 + }
  37 +
  38 + public static void pushLocals(Type[] locals, InsnList insns, int pos)
  39 + {
  40 + for (; pos < locals.length; pos++)
  41 + {
  42 + if (locals[pos] != null)
  43 + {
  44 + insns.add(new VarInsnNode(locals[pos].getOpcode(Opcodes.ILOAD), pos));
  45 + }
  46 + }
  47 + }
  48 +
  49 + /**
  50 + * @param method
  51 + * @param node
  52 + * @return
  53 + */
  54 + public static LocalVariableNode[] getLocalsAt(ClassNode classNode, MethodNode method, AbstractInsnNode node)
  55 + {
  56 + LocalVariableNode[] frame = new LocalVariableNode[method.maxLocals];
  57 +
  58 + if ((method.access & Opcodes.ACC_STATIC) == 0)
  59 + {
  60 + frame[0] = new LocalVariableNode("this", classNode.name, null, null, null, 0);
  61 + }
  62 +
  63 + for (Iterator<AbstractInsnNode> iter = method.instructions.iterator(); iter.hasNext();)
  64 + {
  65 + AbstractInsnNode insn = iter.next();
  66 + if (insn instanceof FrameNode)
  67 + {
  68 + FrameNode frameNode = (FrameNode)insn;
  69 + int localPos = 0;
  70 + for (int framePos = 0; framePos < frame.length; framePos++)
  71 + {
  72 + final Object localType = (localPos < frameNode.local.size()) ? frameNode.local.get(localPos) : null;
  73 + if (localType instanceof String)
  74 + {
  75 + frame[framePos] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, framePos);
  76 + }
  77 + else if (localType instanceof Integer)
  78 + {
  79 + boolean isMarkerType = localType == Opcodes.UNINITIALIZED_THIS || localType == Opcodes.TOP || localType == Opcodes.NULL;
  80 + boolean is32bitValue = localType == Opcodes.INTEGER || localType == Opcodes.FLOAT;
  81 + boolean is64bitValue = localType == Opcodes.DOUBLE || localType == Opcodes.LONG;
  82 + if (isMarkerType)
  83 + {
  84 + frame[framePos] = null;
  85 + }
  86 + else if (is32bitValue || is64bitValue)
  87 + {
  88 + frame[framePos] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, framePos);
  89 +
  90 + if (is64bitValue)
  91 + {
  92 + framePos++;
  93 + }
  94 + }
  95 + }
  96 + else if (localType == null)
  97 + {
  98 + frame[framePos] = null;
  99 + }
  100 + else
  101 + {
  102 + throw new RuntimeException("Invalid value " + localType + " in locals array at position " + localPos + " in " + classNode.name + "." + method.name + method.desc);
  103 + }
  104 +
  105 + localPos++;
  106 + }
  107 + }
  108 + else if (insn instanceof VarInsnNode)
  109 + {
  110 + VarInsnNode varNode = (VarInsnNode)insn;
  111 + frame[varNode.var] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, varNode.var);
  112 + }
  113 + else if (insn == node)
  114 + {
  115 + break;
  116 + }
  117 + }
  118 +
  119 + return frame;
  120 + }
  121 +
  122 + /**
  123 + * @param classNode
  124 + * @param method
  125 + * @param node
  126 + * @param var
  127 + * @return
  128 + */
  129 + public static LocalVariableNode getLocalVariableAt(ClassNode classNode, MethodNode method, AbstractInsnNode node, int var)
  130 + {
  131 + LocalVariableNode localVariableNode = null;
  132 +
  133 + int pos = method.instructions.indexOf(node);
  134 +
  135 + for (LocalVariableNode local : method.localVariables)
  136 + {
  137 + if (local.index != var) continue;
  138 + int start = method.instructions.indexOf(local.start);
  139 + int end = method.instructions.indexOf(local.end);
  140 + if (localVariableNode == null || start < pos && end > pos)
  141 + {
  142 + localVariableNode = local;
  143 + }
  144 + }
  145 +
  146 + return localVariableNode;
  147 + }
  148 +
  149 + /**
  150 + * @param type
  151 + * @return
  152 + */
  153 + public static String getTypeName(Type type)
  154 + {
  155 + switch (type.getSort())
  156 + {
  157 + case Type.BOOLEAN: return "boolean";
  158 + case Type.CHAR: return "char";
  159 + case Type.BYTE: return "byte";
  160 + case Type.SHORT: return "short";
  161 + case Type.INT: return "int";
  162 + case Type.FLOAT: return "float";
  163 + case Type.LONG: return "long";
  164 + case Type.DOUBLE: return "double";
  165 + case Type.ARRAY: return ByteCodeUtilities.getTypeName(type.getElementType()) + "[]";
  166 + case Type.OBJECT:
  167 + String typeName = type.getClassName();
  168 + typeName = typeName.substring(typeName.lastIndexOf('.') + 1);
  169 + return typeName;
  170 + }
  171 +
  172 + return "Object";
  173 + }
  174 +
  175 + /**
  176 + * Finds a method in the target class, uses names specified in the {@link Obfuscated} annotation if present
  177 + *
  178 + * @param targetClass
  179 + * @param searchFor
  180 + * @return
  181 + */
  182 + public static MethodNode findTargetMethod(ClassNode targetClass, MethodNode searchFor)
  183 + {
  184 + for (MethodNode target : targetClass.methods)
  185 + {
  186 + if (target.name.equals(searchFor.name) && target.desc.equals(searchFor.desc))
  187 + return target;
  188 + }
  189 +
  190 + AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getAnnotation(searchFor, Obfuscated.class);
  191 + if (obfuscatedAnnotation != null)
  192 + {
  193 + for (String obfuscatedName : ByteCodeUtilities.<List<String>>getAnnotationValue(obfuscatedAnnotation))
  194 + {
  195 + for (MethodNode target : targetClass.methods)
  196 + {
  197 + if (target.name.equals(obfuscatedName) && target.desc.equals(searchFor.desc))
  198 + return target;
  199 + }
  200 + }
  201 + }
  202 +
  203 + return null;
  204 + }
  205 +
  206 + /**
  207 + * Finds a field in the target class, uses names specified in the {@link Obfuscated} annotation if present
  208 + *
  209 + * @param targetClass
  210 + * @param searchFor
  211 + * @return
  212 + */
  213 + public static FieldNode findTargetField(ClassNode targetClass, FieldNode searchFor)
  214 + {
  215 + for (FieldNode target : targetClass.fields)
  216 + {
  217 + if (target.name.equals(searchFor.name))
  218 + return target;
  219 + }
  220 +
  221 + AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getAnnotation(searchFor, Obfuscated.class);
  222 + if (obfuscatedAnnotation != null)
  223 + {
  224 + for (String obfuscatedName : ByteCodeUtilities.<List<String>>getAnnotationValue(obfuscatedAnnotation))
  225 + {
  226 + for (FieldNode target : targetClass.fields)
  227 + {
  228 + if (target.name.equals(obfuscatedName))
  229 + return target;
  230 + }
  231 + }
  232 + }
  233 +
  234 + return null;
  235 + }
  236 +
  237 + /**
  238 + * Get an annotation of the specified class from the supplied field node
  239 + *
  240 + * @param field
  241 + * @param annotationType
  242 + * @return
  243 + */
  244 + public static AnnotationNode getAnnotation(FieldNode field, Class<? extends Annotation> annotationClass)
  245 + {
  246 + return ByteCodeUtilities.getAnnotation(field.visibleAnnotations, Type.getDescriptor(annotationClass));
  247 + }
  248 +
  249 + /**
  250 + * Get an annotation of the specified class from the supplied method node
  251 + *
  252 + * @param method
  253 + * @param annotationType
  254 + * @return
  255 + */
  256 + public static AnnotationNode getAnnotation(MethodNode method, Class<? extends Annotation> annotationClass)
  257 + {
  258 + return ByteCodeUtilities.getAnnotation(method.visibleAnnotations, Type.getDescriptor(annotationClass));
  259 + }
  260 +
  261 + /**
  262 + * @param annotations
  263 + * @param annotationType
  264 + * @return
  265 + */
  266 + public static AnnotationNode getAnnotation(List<AnnotationNode> annotations, String annotationType)
  267 + {
  268 + if (annotations != null)
  269 + {
  270 + for (AnnotationNode annotation : annotations)
  271 + {
  272 + if (annotationType.equals(annotation.desc))
  273 + return annotation;
  274 + }
  275 + }
  276 +
  277 + return null;
  278 + }
  279 +
  280 + /**
  281 + * Get the value of an annotation node
  282 + *
  283 + * @param annotation
  284 + * @return
  285 + */
  286 + public static <T> T getAnnotationValue(AnnotationNode annotation)
  287 + {
  288 + return ByteCodeUtilities.getAnnotationValue(annotation, "value");
  289 + }
  290 +
  291 + /**
  292 + * @param annotation
  293 + * @param key
  294 + * @return
  295 + */
  296 + @SuppressWarnings("unchecked")
  297 + public static <T> T getAnnotationValue(AnnotationNode annotation, String key)
  298 + {
  299 + boolean getNextValue = false;
  300 + for (Object value : annotation.values)
  301 + {
  302 + if (getNextValue) return (T)value;
  303 + if (value.equals(key)) getNextValue = true;
  304 + }
  305 + return null;
  306 + }
  307 +}
... ...
java/common/com/mumfrey/liteloader/transformers/CallbackInjectionTransformer.java
... ... @@ -25,7 +25,9 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
25 25 * Transformer which injects callbacks by searching for profiler invokations and RETURN opcodes
26 26 *
27 27 * @author Adam Mummery-Smith
  28 + * @deprecated Use Event Injection instead
28 29 */
  30 +@Deprecated
29 31 public abstract class CallbackInjectionTransformer extends ClassTransformer
30 32 {
31 33 /**
... ...
java/common/com/mumfrey/liteloader/transformers/ClassOverlayTransformer.java
1 1 package com.mumfrey.liteloader.transformers;
2 2  
3 3 import java.io.IOException;
4   -import java.lang.annotation.Annotation;
5 4 import java.util.HashMap;
6 5 import java.util.HashSet;
7 6 import java.util.Iterator;
... ... @@ -288,7 +287,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
288 287 throw new InvalidOverlayException(String.format("Overlay classes cannot contain non-private static methods or fields, found %s", field.name));
289 288 }
290 289  
291   - FieldNode target = this.findTargetField(targetClass, field);
  290 + FieldNode target = ByteCodeUtilities.findTargetField(targetClass, field);
292 291 if (target == null)
293 292 {
294 293 targetClass.fields.add(field);
... ... @@ -319,7 +318,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
319 318 {
320 319 for (MethodNode overlayMethod : overlayClass.methods)
321 320 {
322   - if (this.getAnnotation(overlayMethod, Stub.class) != null || (this.getAnnotation(overlayMethod, AppendInsns.class) == null && !overlayMethod.name.startsWith("<")))
  321 + if (ByteCodeUtilities.getAnnotation(overlayMethod, Stub.class) != null || (ByteCodeUtilities.getAnnotation(overlayMethod, AppendInsns.class) == null && !overlayMethod.name.startsWith("<")))
323 322 {
324 323 this.checkRenameMethod(targetClass, overlayMethod);
325 324 }
... ... @@ -338,12 +337,12 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
338 337 {
339 338 this.transformMethod(overlayMethod, overlayClass.name, targetClass.name);
340 339  
341   - AnnotationNode appendAnnotation = this.getAnnotation(overlayMethod, AppendInsns.class);
342   - AnnotationNode stubAnnotation = this.getAnnotation(overlayMethod, Stub.class);
  340 + AnnotationNode appendAnnotation = ByteCodeUtilities.getAnnotation(overlayMethod, AppendInsns.class);
  341 + AnnotationNode stubAnnotation = ByteCodeUtilities.getAnnotation(overlayMethod, Stub.class);
343 342  
344 343 if (stubAnnotation != null)
345 344 {
346   - MethodNode target = this.findTargetMethod(targetClass, overlayMethod);
  345 + MethodNode target = ByteCodeUtilities.findTargetMethod(targetClass, overlayMethod);
347 346 if (target == null)
348 347 {
349 348 throw new InvalidOverlayException(String.format("Stub method %s was not located in the target class", overlayMethod.name));
... ... @@ -351,7 +350,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
351 350 }
352 351 else if (appendAnnotation != null)
353 352 {
354   - String targetMethodName = this.<String>getAnnotationValue(appendAnnotation);
  353 + String targetMethodName = ByteCodeUtilities.<String>getAnnotationValue(appendAnnotation);
355 354 this.appendInsns(targetClass, targetMethodName, overlayMethod);
356 355 }
357 356 else if (!overlayMethod.name.startsWith("<"))
... ... @@ -361,7 +360,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
361 360 continue;
362 361 }
363 362  
364   - MethodNode target = this.findTargetMethod(targetClass, overlayMethod);
  363 + MethodNode target = ByteCodeUtilities.findTargetMethod(targetClass, overlayMethod);
365 364 if (target != null) targetClass.methods.remove(target);
366 365 targetClass.methods.add(overlayMethod);
367 366 }
... ... @@ -434,10 +433,10 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
434 433 if (targetMethodName == null || targetMethodName.length() == 0) targetMethodName = sourceMethod.name;
435 434  
436 435 Set<String> obfuscatedNames = new HashSet<String>();
437   - AnnotationNode obfuscatedAnnotation = this.getAnnotation(sourceMethod, Obfuscated.class);
  436 + AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getAnnotation(sourceMethod, Obfuscated.class);
438 437 if (obfuscatedAnnotation != null)
439 438 {
440   - obfuscatedNames.addAll(this.<List<String>>getAnnotationValue(obfuscatedAnnotation));
  439 + obfuscatedNames.addAll(ByteCodeUtilities.<List<String>>getAnnotationValue(obfuscatedAnnotation));
441 440 }
442 441  
443 442 for (MethodNode method : targetClass.methods)
... ... @@ -475,7 +474,7 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
475 474 */
476 475 private void checkRenameMethod(ClassNode targetClass, MethodNode searchFor)
477 476 {
478   - MethodNode target = this.findTargetMethod(targetClass, searchFor);
  477 + MethodNode target = ByteCodeUtilities.findTargetMethod(targetClass, searchFor);
479 478 if (target != null && !target.name.equals(searchFor.name))
480 479 {
481 480 String methodDescriptor = searchFor.name + searchFor.desc;
... ... @@ -485,139 +484,6 @@ public abstract class ClassOverlayTransformer extends ClassTransformer
485 484 }
486 485  
487 486 /**
488   - * Finds a method in the target class, uses names specified in the {@link Obfuscated} annotation if present
489   - *
490   - * @param targetClass
491   - * @param searchFor
492   - * @return
493   - */
494   - private MethodNode findTargetMethod(ClassNode targetClass, MethodNode searchFor)
495   - {
496   - for (MethodNode target : targetClass.methods)
497   - {
498   - if (target.name.equals(searchFor.name) && target.desc.equals(searchFor.desc))
499   - return target;
500   - }
501   -
502   - AnnotationNode obfuscatedAnnotation = this.getAnnotation(searchFor, Obfuscated.class);
503   - if (obfuscatedAnnotation != null)
504   - {
505   - for (String obfuscatedName : this.<List<String>>getAnnotationValue(obfuscatedAnnotation))
506   - {
507   - for (MethodNode target : targetClass.methods)
508   - {
509   - if (target.name.equals(obfuscatedName) && target.desc.equals(searchFor.desc))
510   - return target;
511   - }
512   - }
513   - }
514   -
515   - return null;
516   - }
517   -
518   - /**
519   - * Finds a field in the target class, uses names specified in the {@link Obfuscated} annotation if present
520   - *
521   - * @param targetClass
522   - * @param searchFor
523   - * @return
524   - */
525   - private FieldNode findTargetField(ClassNode targetClass, FieldNode searchFor)
526   - {
527   - for (FieldNode target : targetClass.fields)
528   - {
529   - if (target.name.equals(searchFor.name))
530   - return target;
531   - }
532   -
533   - AnnotationNode obfuscatedAnnotation = this.getAnnotation(searchFor, Obfuscated.class);
534   - if (obfuscatedAnnotation != null)
535   - {
536   - for (String obfuscatedName : this.<List<String>>getAnnotationValue(obfuscatedAnnotation))
537   - {
538   - for (FieldNode target : targetClass.fields)
539   - {
540   - if (target.name.equals(obfuscatedName))
541   - return target;
542   - }
543   - }
544   - }
545   -
546   - return null;
547   - }
548   -
549   - /**
550   - * Get an annotation of the specified class from the supplied field node
551   - *
552   - * @param field
553   - * @param annotationType
554   - * @return
555   - */
556   - private AnnotationNode getAnnotation(FieldNode field, Class<? extends Annotation> annotationClass)
557   - {
558   - return this.getAnnotation(field.visibleAnnotations, Type.getDescriptor(annotationClass));
559   - }
560   -
561   - /**
562   - * Get an annotation of the specified class from the supplied method node
563   - *
564   - * @param method
565   - * @param annotationType
566   - * @return
567   - */
568   - private AnnotationNode getAnnotation(MethodNode method, Class<? extends Annotation> annotationClass)
569   - {
570   - return this.getAnnotation(method.visibleAnnotations, Type.getDescriptor(annotationClass));
571   - }
572   -
573   - /**
574   - * @param annotations
575   - * @param annotationType
576   - * @return
577   - */
578   - private AnnotationNode getAnnotation(List<AnnotationNode> annotations, String annotationType)
579   - {
580   - if (annotations != null)
581   - {
582   - for (AnnotationNode annotation : annotations)
583   - {
584   - if (annotationType.equals(annotation.desc))
585   - return annotation;
586   - }
587   - }
588   -
589   - return null;
590   - }
591   -
592   - /**
593   - * Get the value of an annotation node
594   - *
595   - * @param annotation
596   - * @return
597   - */
598   - private <T> T getAnnotationValue(AnnotationNode annotation)
599   - {
600   - return this.getAnnotationValue(annotation, "value");
601   - }
602   -
603   - /**
604   - * @param annotation
605   - * @param key
606   - * @return
607   - */
608   - @SuppressWarnings("unchecked")
609   - private <T> T getAnnotationValue(AnnotationNode annotation, String key)
610   - {
611   - boolean getNextValue = false;
612   - for (Object value : annotation.values)
613   - {
614   - if (getNextValue) return (T)value;
615   - if (value.equals(key)) getNextValue = true;
616   - }
617   - return null;
618   - }
619   -
620   - /**
621 487 * @param transformedName
622 488 * @return
623 489 * @throws InvalidOverlayException
... ...
java/common/com/mumfrey/liteloader/transformers/ClassTransformer.java
1 1 package com.mumfrey.liteloader.transformers;
2 2  
  3 +import net.minecraft.launchwrapper.IClassTransformer;
  4 +
3 5 import org.objectweb.asm.ClassReader;
4 6 import org.objectweb.asm.ClassWriter;
5 7 import org.objectweb.asm.tree.ClassNode;
6 8  
7   -import net.minecraft.launchwrapper.IClassTransformer;
8   -
9 9 /**
10 10 * Base class for transformers which work via ClassNode
11 11 *
... ... @@ -13,6 +13,8 @@ import net.minecraft.launchwrapper.IClassTransformer;
13 13 */
14 14 public abstract class ClassTransformer implements IClassTransformer
15 15 {
  16 + public static final String HORIZONTAL_RULE = "----------------------------------------------------------------------------------------------------";
  17 +
16 18 private ClassReader classReader;
17 19 private ClassNode classNode;
18 20  
... ... @@ -52,4 +54,11 @@ public abstract class ClassTransformer implements IClassTransformer
52 54 classNode.accept(writer);
53 55 return writer.toByteArray();
54 56 }
  57 +
  58 + protected static String getSimpleClassName(ClassNode classNode)
  59 + {
  60 + String className = classNode.name.replace('/', '.');
  61 + int dotPos = className.lastIndexOf('.');
  62 + return dotPos == -1 ? className : className.substring(dotPos + 1);
  63 + }
55 64 }
56 65 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/transformers/PacketTransformer.java deleted 100644 → 0
1   -package com.mumfrey.liteloader.transformers;
2   -
3   -import java.util.HashSet;
4   -import java.util.List;
5   -import java.util.Set;
6   -
7   -import org.objectweb.asm.Opcodes;
8   -import org.objectweb.asm.tree.ClassNode;
9   -import org.objectweb.asm.tree.InsnList;
10   -import org.objectweb.asm.tree.InsnNode;
11   -import org.objectweb.asm.tree.LabelNode;
12   -import org.objectweb.asm.tree.MethodInsnNode;
13   -import org.objectweb.asm.tree.MethodNode;
14   -import org.objectweb.asm.tree.TryCatchBlockNode;
15   -import org.objectweb.asm.tree.VarInsnNode;
16   -
17   -import com.mumfrey.liteloader.core.runtime.Obf;
18   -import com.mumfrey.liteloader.util.SortableValue;
19   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
20   -
21   -/**
22   - * Class transformer which transforms a Packet class and alters the "processPacket" function to call the specified
23   - * callback method in the specified callback class instead of the usual behaviour of calling the relevant synthetic bridge
24   - * method in the packet class itself.
25   - *
26   - * @author Adam Mummery-Smith
27   - * @deprecated This transformer will be retired in favour of event-based packed hooks for 1.8 and beyond
28   - */
29   -@Deprecated
30   -public abstract class PacketTransformer extends ClassTransformer
31   -{
32   - private static final Set<String> transformedPackets = new HashSet<String>();
33   - private static int transformerOrder = 0;
34   -
35   - private final String packetClass;
36   - private final String packetClassObf;
37   -
38   - private final String handlerClassName;
39   - private final String handlerMethodName;
40   -
41   - private final boolean prepend;
42   - private final int priority;
43   - private final int order;
44   -
45   - /**
46   - * Create a PacketTransformer with default priority
47   - *
48   - * @param packetClass Packet class name we want to override (FQ)
49   - * @param handlerClassName Name of the class which will handle the callback
50   - * @param handlerMethodName Method name to map to in handlerClass (must have signature (INetHandler, PacketClass)Void)
51   - */
52   - protected PacketTransformer(Obf packetClass, String handlerClassName, String handlerMethodName)
53   - {
54   - this(packetClass.name, packetClass.obf, handlerClassName, handlerMethodName, 0);
55   - }
56   -
57   - /**
58   - * Create a PacketTransformer with default priority
59   - *
60   - * @param packetClass Packet class name we want to override (FQ)
61   - * @param packetClassObf Obfuscated packet class name
62   - * @param handlerClassName Name of the class which will handle the callback
63   - * @param handlerMethodName Method name to map to in handlerClass (must have signature (INetHandler, PacketClass)Void)
64   - */
65   - protected PacketTransformer(String packetClass, String packetClassObf, String handlerClassName, String handlerMethodName)
66   - {
67   - this(packetClass, packetClassObf, handlerClassName, handlerMethodName, 0);
68   - }
69   -
70   - /**
71   - * Create a PacketTransformer with default priority
72   - *
73   - * @param packetClass Packet class name we want to override (FQ)
74   - * @param handlerClassName Name of the class which will handle the callback
75   - * @param handlerMethodName Method name to map to in handlerClass (must have signature (INetHandler, PacketClass)Void)
76   - * @param priority transformer priority, if there are multiple transformers registered for this packet then higher priority handlers are called before lower priority ones, default priority is 0
77   - */
78   - protected PacketTransformer(Obf packetClass, String handlerClassName, String handlerMethodName, int priority)
79   - {
80   - this(packetClass.name, packetClass.obf, handlerClassName, handlerMethodName, priority);
81   - }
82   -
83   - /**
84   - * Create a PacketTransformer with default priority
85   - *
86   - * @param packetClass Packet class name we want to override (FQ)
87   - * @param packetClassObf Obfuscated packet class name
88   - * @param handlerClassName Name of the class which will handle the callback
89   - * @param handlerMethodName Method name to map to in handlerClass (must have signature (INetHandler, PacketClass)Void)
90   - * @param priority transformer priority, if there are multiple transformers registered for this packet then higher priority handlers are called before lower priority ones, default priority is 0
91   - */
92   - protected PacketTransformer(String packetClass, String packetClassObf, String handlerClassName, String handlerMethodName, int priority)
93   - {
94   - this.packetClass = packetClass;
95   - this.packetClassObf = packetClassObf;
96   - this.handlerClassName = handlerClassName.replace('.', '/');
97   - this.handlerMethodName = handlerMethodName;
98   -
99   - this.prepend = PacketTransformer.transformedPackets.contains(packetClass);
100   - PacketTransformer.transformedPackets.add(packetClass);
101   -
102   - this.priority = priority;
103   - this.order = PacketTransformer.transformerOrder++;
104   - }
105   -
106   - /* (non-Javadoc)
107   - * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[])
108   - */
109   - @Override
110   - public final byte[] transform(String name, String transformedName, byte[] basicClass)
111   - {
112   - if (basicClass != null && (this.packetClass.equals(transformedName) || this.packetClassObf.equals(transformedName)))
113   - {
114   - LiteLoaderLogger.info("PacketTransformer: Running transformer %s for %s", this.getClass().getName(), name);
115   -
116   - try
117   - {
118   - byte[] transformedClass = this.transformClass(transformedName, basicClass);
119   - this.notifyInjected();
120   - return transformedClass;
121   - }
122   - catch (Exception ex) { ex.printStackTrace(); }
123   - }
124   -
125   - return basicClass;
126   - }
127   -
128   - /**
129   - * Found the packet class we want to transform, attempt to transform it
130   - *
131   - * @param className
132   - * @param basicClass
133   - * @return
134   - */
135   - private byte[] transformClass(String className, byte[] basicClass)
136   - {
137   - ClassNode classNode = this.readClass(basicClass, true);
138   -
139   - // Try and transform obfuscated first
140   - if (!this.tryTransformMethod(className, classNode, Obf.processPacket.obf, Obf.INetHandler.obf))
141   - {
142   - // Try to transform srg for use with fml
143   - if (!this.tryTransformMethod(className, classNode, Obf.processPacket.srg, Obf.INetHandler.ref))
144   - {
145   - // Try to transform non-obf for use in dev env
146   - if (!this.tryTransformMethod(className, classNode, Obf.processPacket.name, Obf.INetHandler.ref))
147   - {
148   - LiteLoaderLogger.warning("PacketTransformer: failed transforming class '%s' (%s)", this.packetClass, this.packetClassObf);
149   - }
150   - }
151   - }
152   -
153   - return this.writeClass(classNode);
154   - }
155   -
156   - /**
157   - * @param className
158   - * @param classNode
159   - * @param functionName
160   - * @param netHandlerClassName
161   - */
162   - private boolean tryTransformMethod(String className, ClassNode classNode, String functionName, String netHandlerClassName)
163   - {
164   - MethodNode method = this.findMethodByNameAndSignature(classNode.methods, functionName, "(L" + netHandlerClassName + ";)V");
165   -
166   - if (method != null)
167   - {
168   - String targetMethodSig = "(L" + netHandlerClassName + ";L" + className.replace('.', '/') + ";)V";
169   - this.transformMethod(className, method, targetMethodSig);
170   - return true;
171   - }
172   -
173   - return false;
174   - }
175   -
176   - /**
177   - * Clear the old method contents and replace with the call to our handler function
178   - *
179   - * @param method
180   - * @param targetMethodSig
181   - */
182   - private void transformMethod(String className, MethodNode method, String targetMethodSig)
183   - {
184   - if (this.prepend)
185   - {
186   - InsnList insns = new InsnList();
187   -
188   - // Push method argument 1 (INetHandler instance) onto the stack
189   - insns.add(new VarInsnNode(Opcodes.ALOAD, 1));
190   -
191   - // Push "this" onto the stack
192   - insns.add(new VarInsnNode(Opcodes.ALOAD, 0));
193   -
194   - // Invoke the handler function with the args we just pushed onto the stack
195   - insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, this.handlerClassName, this.handlerMethodName, targetMethodSig, false));
196   -
197   - method.instructions.insert(method.instructions.getFirst(), insns);
198   - }
199   - else
200   - {
201   - // Labels for try/catch
202   - LabelNode tryLabel = new LabelNode();
203   - LabelNode catchLabel = new LabelNode();
204   -
205   - // Add try/catch
206   - method.tryCatchBlocks.clear();
207   - method.tryCatchBlocks.add(new TryCatchBlockNode(tryLabel, catchLabel, catchLabel, PacketHandlerException.class.getName().replace('.', '/')));
208   -
209   - // Dump the old method content, we don't want it any more
210   - method.instructions.clear();
211   -
212   - // Try
213   - method.instructions.add(tryLabel);
214   -
215   - // Push method argument 1 (INetHandler instance) onto the stack
216   - method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
217   -
218   - // Push "this" onto the stack
219   - method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
220   -
221   - // Invoke the handler function with the args we just pushed onto the stack
222   - method.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, this.handlerClassName, this.handlerMethodName, targetMethodSig, false));
223   -
224   - // Return if no exception
225   - method.instructions.add(new InsnNode(Opcodes.RETURN));
226   -
227   - // Catch
228   - method.instructions.add(catchLabel);
229   -
230   - // Return if exception caught
231   - method.instructions.add(new InsnNode(Opcodes.RETURN));
232   - }
233   - }
234   -
235   - /**
236   - * For ordering transformers, returns the class name this transformer wants to transform
237   - */
238   - public final String getPacketClass()
239   - {
240   - return this.packetClass;
241   - }
242   -
243   - /**
244   - * Get the priority of this transformer, higher priority transformers run earlier
245   - */
246   - public final int getPriority()
247   - {
248   - return this.priority;
249   - }
250   -
251   - /**
252   - * For subclasses, to set a local flag indicating the code was successfully injected
253   - */
254   - protected abstract void notifyInjected();
255   -
256   - /**
257   - * For subclasses, indicates the transformer ran but was not successful
258   - */
259   - protected abstract void notifyInjectionFailed();
260   -
261   - /**
262   - * @param classNode
263   - * @param funcName
264   - * @param funcNameObf
265   - * @param funcSig
266   - * @param funcSigObf
267   - * @return
268   - */
269   - private MethodNode findMethodByNameAndSignature(List<MethodNode> methods, String funcName, String funcSig)
270   - {
271   - for (MethodNode method : methods)
272   - {
273   - if (funcName.equals(method.name) && funcSig.equals(method.desc))
274   - return method;
275   - }
276   -
277   - return null;
278   - }
279   -
280   - /**
281   - * @param className
282   - * @return
283   - */
284   - public final SortableValue<String> getInfo(String className)
285   - {
286   - return new SortableValue<String>(this.priority, this.order, className);
287   - }
288   -}
289 0 \ No newline at end of file
java/common/com/mumfrey/liteloader/transformers/event/Event.java
... ... @@ -15,6 +15,7 @@ import org.objectweb.asm.Type;
15 15 import org.objectweb.asm.tree.*;
16 16  
17 17 import com.mumfrey.liteloader.core.runtime.Obf;
  18 +import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
18 19 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
19 20  
20 21 /**
... ... @@ -94,7 +95,9 @@ public class Event implements Comparable&lt;Event&gt;
94 95 protected String eventInfoClass;
95 96  
96 97 protected Set<MethodInfo> pendingInjections;
97   -
  98 +
  99 + private int injectionCount = 0;
  100 +
98 101 protected Event(String name, boolean cancellable, int priority)
99 102 {
100 103 this.name = name.toLowerCase();
... ... @@ -188,7 +191,7 @@ public class Event implements Comparable&lt;Event&gt;
188 191 {
189 192 return this.priority;
190 193 }
191   -
  194 +
192 195 /**
193 196 * Get whether this event is currently attached to a method
194 197 */
... ... @@ -212,7 +215,7 @@ public class Event implements Comparable&lt;Event&gt;
212 215 throw new IllegalStateException("Attempted to attach the event " + this.name + " to " + method.name + " but the event was already attached to " + this.method.name + "!");
213 216 }
214 217  
215   - this.method = method;
  218 + this.method = method;
216 219 this.methodReturnType = Type.getReturnType(method.desc);
217 220 this.methodMAXS = method.maxStack;
218 221 this.methodIsStatic = (method.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
... ... @@ -260,6 +263,24 @@ public class Event implements Comparable&lt;Event&gt;
260 263 }
261 264 }
262 265  
  266 + int dumpInjectionState()
  267 + {
  268 + int uninjectedCount = 0;
  269 + int pendingInjectionCount = this.pendingInjections != null ? this.pendingInjections.size() : 0;
  270 +
  271 + LiteLoaderLogger.debug(" Event: %-40s Injected: %d Pending: %d %s", this.name, this.injectionCount, pendingInjectionCount, this.injectionCount == 0 ? " <<< NOT INJECTED >>>" : "");
  272 + if (pendingInjectionCount > 0)
  273 + {
  274 + for (MethodInfo pending : this.pendingInjections)
  275 + {
  276 + LiteLoaderLogger.debug(" Pending: %s.%s", pending.getOwners(), pending.toString());
  277 + uninjectedCount++;
  278 + }
  279 + }
  280 +
  281 + return uninjectedCount;
  282 + }
  283 +
263 284 /**
264 285 * Pre-flight check
265 286 *
... ... @@ -286,19 +307,24 @@ public class Event implements Comparable&lt;Event&gt;
286 307 *
287 308 * @return MethodNode for the event handler delegate
288 309 */
289   - final MethodNode inject(final AbstractInsnNode injectionPoint, boolean cancellable, final int globalEventID)
  310 + final MethodNode inject(final AbstractInsnNode injectionPoint, boolean cancellable, final int globalEventID, final boolean captureLocals, final Type[] locals)
290 311 {
291 312 // Pre-flight checks
292 313 this.validate(injectionPoint, cancellable, globalEventID);
293 314  
  315 + Type[] argumentTypes = Type.getArgumentTypes(this.method.desc);
  316 + int initialFrameSize = argumentTypes.length + (this.methodIsStatic ? 0 : 1);
  317 +
  318 + boolean doCaptureLocals = captureLocals && locals != null && locals.length > initialFrameSize;
  319 + String eventDescriptor = this.generateEventDescriptor(doCaptureLocals, locals, argumentTypes, initialFrameSize);
  320 +
294 321 // Create the handler delegate method
295   - MethodNode handler = new MethodNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, Event.getHandlerName(globalEventID), this.eventDescriptor, null, null);
  322 + MethodNode handler = new MethodNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, Event.getHandlerName(globalEventID), eventDescriptor, null, null);
296 323 Event.addMethodToActiveProxy(handler);
297 324  
298 325 LiteLoaderLogger.debug("Event %s is spawning handler %s in class %s", this.name, handler.name, Event.getActiveProxyRef());
299 326  
300   - Type[] argumentTypes = Type.getArgumentTypes(this.method.desc);
301   - int ctorMAXS = 0, invokeMAXS = argumentTypes.length;
  327 + int ctorMAXS = 0, invokeMAXS = argumentTypes.length + (doCaptureLocals ? locals.length - initialFrameSize : 0);
302 328 int eventInfoVar = this.method.maxLocals++;
303 329  
304 330 InsnList insns = new InsnList();
... ... @@ -311,7 +337,11 @@ public class Event implements Comparable&lt;Event&gt;
311 337  
312 338 // Call the event handler method in the proxy
313 339 insns.add(new VarInsnNode(Opcodes.ALOAD, eventInfoVar));
314   - Event.pushArgs(argumentTypes, insns, this.methodIsStatic);
  340 + ByteCodeUtilities.loadArgs(argumentTypes, insns, this.methodIsStatic ? 0 : 1);
  341 + if (doCaptureLocals)
  342 + {
  343 + ByteCodeUtilities.pushLocals(locals, insns, initialFrameSize);
  344 + }
315 345 insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Event.getActiveProxyRef(), handler.name, handler.desc, false));
316 346  
317 347 if (cancellable)
... ... @@ -327,6 +357,19 @@ public class Event implements Comparable&lt;Event&gt;
327 357 return handler;
328 358 }
329 359  
  360 + private String generateEventDescriptor(final boolean captureLocals, final Type[] locals, Type[] argumentTypes, int startIndex)
  361 + {
  362 + if (!captureLocals) return this.eventDescriptor;
  363 +
  364 + String eventDescriptor = this.eventDescriptor.substring(0, this.eventDescriptor.indexOf(')'));
  365 + for (int l = startIndex; l < locals.length; l++)
  366 + {
  367 + if (locals[l] != null) eventDescriptor += locals[l].getDescriptor();
  368 + }
  369 +
  370 + return eventDescriptor + ")V";
  371 + }
  372 +
330 373 protected int invokeEventInfoConstructor(InsnList insns, boolean cancellable)
331 374 {
332 375 int ctorMAXS = 0;
... ... @@ -404,6 +447,7 @@ public class Event implements Comparable&lt;Event&gt;
404 447 LiteLoaderLogger.debug("Adding event %s to handler %s", this.name, handler.name);
405 448  
406 449 Event.getEventsForHandlerMethod(handler).add(this);
  450 + this.injectionCount++;
407 451 }
408 452  
409 453 /**
... ... @@ -522,7 +566,7 @@ public class Event implements Comparable&lt;Event&gt;
522 566 insns.add(lineNumberLabel);
523 567 insns.add(new LineNumberNode(++lineNumber, lineNumberLabel));
524 568  
525   - Event.pushArgs(args, insns, true);
  569 + ByteCodeUtilities.loadArgs(args, insns, 0);
526 570 insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, listener.ownerRef, listener.getOrInflectName(event.name), handlerMethod.desc, false));
527 571 }
528 572  
... ... @@ -581,21 +625,7 @@ public class Event implements Comparable&lt;Event&gt;
581 625 {
582 626 return Obf.EventProxy.ref + (Event.proxyInnerClassIndex > 1 ? "$" + Event.proxyInnerClassIndex : "");
583 627 }
584   -
585   - /**
586   - * @param args
587   - * @param insns
588   - */
589   - private static void pushArgs(Type[] args, InsnList insns, boolean isStatic)
590   - {
591   - int argNumber = isStatic ? 0 : 1;
592   - for (Type type : args)
593   - {
594   - insns.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), argNumber));
595   - argNumber += type.getSize();
596   - }
597   - }
598   -
  628 +
599 629 @Override
600 630 public int compareTo(Event other)
601 631 {
... ...
java/common/com/mumfrey/liteloader/transformers/event/EventInjectionTransformer.java
1 1 package com.mumfrey.liteloader.transformers.event;
2 2  
3   -import java.util.ArrayList;
4   -import java.util.Collection;
5   -import java.util.HashMap;
6   -import java.util.LinkedHashMap;
7   -import java.util.Map;
8   -import java.util.Map.Entry;
9   -import java.util.Set;
10   -import java.util.TreeSet;
  3 +import net.minecraft.launchwrapper.IClassTransformer;
11 4  
12   -import org.objectweb.asm.ClassWriter;
13   -import org.objectweb.asm.tree.AbstractInsnNode;
14   -import org.objectweb.asm.tree.ClassNode;
15   -import org.objectweb.asm.tree.MethodNode;
16   -import org.objectweb.asm.util.CheckClassAdapter;
17   -
18   -import com.mumfrey.liteloader.transformers.ClassTransformer;
19   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
20   -
21   -/**
22   - * EventInjectionTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced
23   - * and flexible version of the same premise. Like the CallbackInjectionTransformer, it can be used to inject callbacks
24   - * intelligently into a target method, however it has the following additional capabilities which make it more flexible
25   - * and scalable:
26   - *
27   - * + Injections are not restricted to RETURN opcodes or profiler invokations, each injection is determined by
28   - * supplying an InjectionPoint instance to the {@code addEvent} method which is used to find the injection
29   - * point(s) in the method
30   - *
31   - * + Injected events can optionally be specified as *cancellable* which allows method execution to be pre-emptively
32   - * halted based on the cancellation status of the event. For methods with a return value, the return value may
33   - * be specified by the event handler.
34   - *
35   - * + Injected events call back against a dynamically-generated proxy class, this means that it is no longer necessary
36   - * to provide your own implementation of a static callback proxy, events can call back directly against handler
37   - * methods in your own codebase.
38   - *
39   - * + Event injections are more intelligent about injecting at arbitrary points in the bytecode without corrupting the
40   - * local stack, and increase MAXS as required.
41   - *
42   - * + Event injections do not "collide" like callback injections do - this means that if multiple events are injected
43   - * by multiple sources at the same point in the bytecode, then all event handlers will receive and handle the event
44   - * in one go. To provide for this, each event handler is defined with an intrinsic "priority" which determines its
45   - * call order when this situation occurs
46   - *
47   - * @author Adam Mummery-Smith
48   - */
49   -public abstract class EventInjectionTransformer extends ClassTransformer
  5 +public abstract class EventInjectionTransformer implements IClassTransformer
50 6 {
51   - /**
52   - * Multidimensional map of class names -> target method signatures -> events to inject
53   - */
54   - private static Map<String, Map<String, Map<Event, InjectionPoint>>> eventMappings = new HashMap<String, Map<String, Map<Event, InjectionPoint>>>();
55   -
56   - /**
57   - * Multiple event injection transformers may exist but to allow co-operation the events themselves are registered
58   - * statically. The first EventInjectionTransformer instance to be created becomes the "master" and is actually responsible
59   - * for injecting the events
60   - */
61   - private static EventInjectionTransformer master;
62   -
63   - /**
64   - * Runs the validator on the generated classes, only for debugging purposes
65   - */
66   - private final boolean runValidator = false;
67   -
68   - private int globalEventID = 0;
69   -
70 7 public EventInjectionTransformer()
71 8 {
72   - if (EventInjectionTransformer.master == null)
73   - {
74   - EventInjectionTransformer.master = this;
75   - }
76   -
77 9 try
78 10 {
79 11 this.addEvents();
... ... @@ -84,6 +16,15 @@ public abstract class EventInjectionTransformer extends ClassTransformer
84 16 }
85 17 }
86 18  
  19 + /* (non-Javadoc)
  20 + * @see net.minecraft.launchwrapper.IClassTransformer#transform(java.lang.String, java.lang.String, byte[])
  21 + */
  22 + @Override
  23 + public byte[] transform(String name, String transformedName, byte[] basicClass)
  24 + {
  25 + return basicClass;
  26 + }
  27 +
87 28 /**
88 29 * Subclasses should register events here
89 30 */
... ... @@ -120,161 +61,18 @@ public abstract class EventInjectionTransformer extends ClassTransformer
120 61 if (injectionPoint == null)
121 62 throw new IllegalArgumentException("Injection point cannot be null for event " + event.getName());
122 63  
123   - this.addEvent(event, targetMethod.owner, targetMethod.sig, injectionPoint);
124   - this.addEvent(event, targetMethod.owner, targetMethod.sigSrg, injectionPoint);
125   - this.addEvent(event, targetMethod.ownerObf, targetMethod.sigObf, injectionPoint);
126   -
127   - event.addPendingInjection(targetMethod);
128   -
129   - return event;
130   - }
131   -
132   - private void addEvent(Event event, String className, String signature, InjectionPoint injectionPoint)
133   - {
134   - Map<String, Map<Event, InjectionPoint>> mappings = EventInjectionTransformer.eventMappings.get(className);
135   - if (mappings == null)
136   - {
137   - mappings = new HashMap<String, Map<Event, InjectionPoint>>();
138   - EventInjectionTransformer.eventMappings.put(className, mappings);
139   - }
140   -
141   - Map<Event, InjectionPoint> events = mappings.get(signature);
142   - if (events == null)
143   - {
144   - events = new LinkedHashMap<Event, InjectionPoint>();
145   - mappings.put(signature, events);
146   - }
147   -
148   - events.put(event, injectionPoint);
149   - }
150   -
151   - @Override
152   - public final byte[] transform(String name, String transformedName, byte[] basicClass)
153   - {
154   - if (EventInjectionTransformer.master == this)
155   - {
156   - if (basicClass != null && EventInjectionTransformer.eventMappings.containsKey(transformedName))
157   - {
158   - return this.injectEvents(basicClass, EventInjectionTransformer.eventMappings.get(transformedName));
159   - }
160   - }
161   -
162   - return basicClass;
163   - }
164   -
165   - private byte[] injectEvents(byte[] basicClass, Map<String, Map<Event, InjectionPoint>> mappings)
166   - {
167   - if (mappings == null) return basicClass;
168   -
169   - ClassNode classNode = this.readClass(basicClass, true);
170   -
171   - for (MethodNode method : classNode.methods)
  64 + if ("true".equals(System.getProperty("mcpenv")))
172 65 {
173   - String signature = MethodInfo.generateSignature(method.name, method.desc);
174   - Map<Event, InjectionPoint> methodInjections = mappings.get(signature);
175   - if (methodInjections != null)
176   - {
177   - this.injectIntoMethod(classNode, signature, method, methodInjections);
178   - }
  66 + EventTransformer.addEvent(event, targetMethod.owner, targetMethod.sig, injectionPoint);
179 67 }
180   -
181   - if (this.runValidator)
  68 + else
182 69 {
183   - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
184   - classNode.accept(new CheckClassAdapter(writer));
  70 + EventTransformer.addEvent(event, targetMethod.owner, targetMethod.sigSrg, injectionPoint);
  71 + EventTransformer.addEvent(event, targetMethod.ownerObf, targetMethod.sigObf, injectionPoint);
185 72 }
186 73  
187   - return this.writeClass(classNode);
188   - }
189   -
190   - /**
191   - * @param classNode
192   - * @param signature
193   - * @param method
194   - * @param methodInjections
195   - */
196   - void injectIntoMethod(ClassNode classNode, String signature, MethodNode method, Map<Event, InjectionPoint> methodInjections)
197   - {
198   - Map<AbstractInsnNode, Set<Event>> injectionPoints = this.findInjectionPoints(classNode, method, methodInjections);
199   -
200   - for (Entry<AbstractInsnNode, Set<Event>> injectionPoint : injectionPoints.entrySet())
201   - {
202   - this.injectEventsAt(classNode, method, injectionPoint.getKey(), injectionPoint.getValue());
203   - }
204   -
205   - for (Event event : methodInjections.keySet())
206   - {
207   - event.notifyInjected(method.name, method.desc, classNode.name);
208   - event.detach();
209   - }
210   - }
211   -
212   - /**
213   - * @param classNode
214   - * @param method
215   - * @param methodInjections
216   - * @return
217   - */
218   - private Map<AbstractInsnNode, Set<Event>> findInjectionPoints(ClassNode classNode, MethodNode method, Map<Event, InjectionPoint> methodInjections)
219   - {
220   - ReadOnlyInsnList insns = new ReadOnlyInsnList(method.instructions);
221   - Collection<AbstractInsnNode> nodes = new ArrayList<AbstractInsnNode>(32);
222   - Map<AbstractInsnNode, Set<Event>> injectionPoints = new LinkedHashMap<AbstractInsnNode, Set<Event>>();
223   - for (Entry<Event, InjectionPoint> eventEntry : methodInjections.entrySet())
224   - {
225   - Event event = eventEntry.getKey();
226   - event.attach(method);
227   - InjectionPoint injectionPoint = eventEntry.getValue();
228   - nodes.clear();
229   - if (injectionPoint.find(method.desc, insns, nodes, event))
230   - {
231   - for (AbstractInsnNode node : nodes)
232   - {
233   - Set<Event> nodeEvents = injectionPoints.get(node);
234   - if (nodeEvents == null)
235   - {
236   - nodeEvents = new TreeSet<Event>();
237   - injectionPoints.put(node, nodeEvents);
238   - }
239   -
240   - nodeEvents.add(event);
241   - }
242   - }
243   - }
244   -
245   - return injectionPoints;
246   - }
247   -
248   - /**
249   - * @param classNode
250   - * @param method
251   - * @param injectionPoint
252   - * @param events
253   - */
254   - private void injectEventsAt(ClassNode classNode, MethodNode method, AbstractInsnNode injectionPoint, Set<Event> events)
255   - {
256   - // Injection is cancellable if ANY of the events on this insn are cancellable
257   - boolean cancellable = false;
258   - for (Event event : events)
259   - cancellable |= event.isCancellable();
260   -
261   - Event head = events.iterator().next();
262   - MethodNode handler = head.inject(injectionPoint, cancellable, this.globalEventID);
263   -
264   - LiteLoaderLogger.info("Injecting %s[x%d] in %s in %s", head.getName(), events.size(), method.name, getSimpleClassName(classNode));
265   -
266   - for (Event event : events)
267   - {
268   - event.addToHandler(handler);
269   - }
  74 + event.addPendingInjection(targetMethod);
270 75  
271   - this.globalEventID++;
272   - }
273   -
274   - private static String getSimpleClassName(ClassNode classNode)
275   - {
276   - String className = classNode.name.replace('/', '.');
277   - int dotPos = className.lastIndexOf('.');
278   - return dotPos == -1 ? className : className.substring(dotPos + 1);
  76 + return event;
279 77 }
280   -}
281 78 \ No newline at end of file
  79 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/EventTransformer.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Collection;
  5 +import java.util.HashMap;
  6 +import java.util.LinkedHashMap;
  7 +import java.util.Map;
  8 +import java.util.Map.Entry;
  9 +import java.util.Set;
  10 +import java.util.TreeSet;
  11 +
  12 +import org.objectweb.asm.ClassWriter;
  13 +import org.objectweb.asm.Opcodes;
  14 +import org.objectweb.asm.Type;
  15 +import org.objectweb.asm.tree.AbstractInsnNode;
  16 +import org.objectweb.asm.tree.ClassNode;
  17 +import org.objectweb.asm.tree.LocalVariableNode;
  18 +import org.objectweb.asm.tree.MethodNode;
  19 +import org.objectweb.asm.util.CheckClassAdapter;
  20 +
  21 +import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
  22 +import com.mumfrey.liteloader.transformers.ClassTransformer;
  23 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  24 +
  25 +/**
  26 + * EventTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced and flexible
  27 + * version of the same premise. Like the CallbackInjectionTransformer, it can be used to inject callbacks intelligently
  28 + * into a target method, however it has the following additional capabilities which make it more flexible and scalable:
  29 + *
  30 + * + Injections are not restricted to RETURN opcodes or profiler invokations, each injection is determined by
  31 + * supplying an InjectionPoint instance to the {@code addEvent} method which is used to find the injection
  32 + * point(s) in the method
  33 + *
  34 + * + Injected events can optionally be specified as *cancellable* which allows method execution to be pre-emptively
  35 + * halted based on the cancellation status of the event. For methods with a return value, the return value may
  36 + * be specified by the event handler.
  37 + *
  38 + * + Injected events call back against a dynamically-generated proxy class, this means that it is no longer necessary
  39 + * to provide your own implementation of a static callback proxy, events can call back directly against handler
  40 + * methods in your own codebase.
  41 + *
  42 + * + Event injections are more intelligent about injecting at arbitrary points in the bytecode without corrupting the
  43 + * local stack, and increase MAXS as required.
  44 + *
  45 + * + Event injections do not "collide" like callback injections do - this means that if multiple events are injected
  46 + * by multiple sources at the same point in the bytecode, then all event handlers will receive and handle the event
  47 + * in one go. To provide for this, each event handler is defined with an intrinsic "priority" which determines its
  48 + * call order when this situation occurs
  49 + *
  50 + * @author Adam Mummery-Smith
  51 + */
  52 +public final class EventTransformer extends ClassTransformer
  53 +{
  54 + /**
  55 + * Multidimensional map of class names -> target method signatures -> events to inject
  56 + */
  57 + private static Map<String, Map<String, Map<Event, InjectionPoint>>> eventMappings = new HashMap<String, Map<String, Map<Event, InjectionPoint>>>();
  58 +
  59 + /**
  60 + * Runs the validator on the generated classes, only for debugging purposes
  61 + */
  62 + private final boolean runValidator = false;
  63 +
  64 + private int globalEventID = 0;
  65 +
  66 + static class Injection
  67 + {
  68 + private final AbstractInsnNode node;
  69 +
  70 + private final boolean captureLocals;
  71 +
  72 + private final Set<Event> events = new TreeSet<Event>();
  73 +
  74 + private boolean hasLocals = false;
  75 +
  76 + private LocalVariableNode[] locals;
  77 +
  78 + public Injection(AbstractInsnNode node, boolean captureLocals)
  79 + {
  80 + this.node = node;
  81 + this.captureLocals = captureLocals;
  82 + }
  83 +
  84 + public AbstractInsnNode getNode()
  85 + {
  86 + return this.node;
  87 + }
  88 +
  89 + public Set<Event> getEvents()
  90 + {
  91 + return this.events;
  92 + }
  93 +
  94 + public LocalVariableNode[] getLocals()
  95 + {
  96 + return this.locals;
  97 + }
  98 +
  99 + public Type[] getLocalTypes()
  100 + {
  101 + if (this.locals == null) return null;
  102 +
  103 + Type[] localTypes = new Type[this.locals.length];
  104 + for (int l = 0; l < this.locals.length; l++)
  105 + {
  106 + if (this.locals[l] != null)
  107 + {
  108 + localTypes[l] = Type.getType(this.locals[l].desc);
  109 + }
  110 + }
  111 + return localTypes;
  112 + }
  113 +
  114 + public boolean hasLocals()
  115 + {
  116 + return this.hasLocals;
  117 + }
  118 +
  119 + public void setLocals(LocalVariableNode[] locals)
  120 + {
  121 + this.hasLocals = true;
  122 + if (locals == null) return;
  123 + this.locals = locals;
  124 + }
  125 +
  126 + public boolean captureLocals()
  127 + {
  128 + return this.captureLocals;
  129 + }
  130 +
  131 + public void checkCaptureLocals(InjectionPoint injectionPoint)
  132 + {
  133 + if (injectionPoint.captureLocals != this.captureLocals)
  134 + {
  135 + throw new RuntimeException("Overlapping injection points defined with incompatible settings. Attempting to handle " + injectionPoint.getClass().getSimpleName() + " with capture locals [" + injectionPoint.captureLocals + "] but already defined injection point with [" + this.captureLocals + "]");
  136 + }
  137 + }
  138 +
  139 + public void add(Event event)
  140 + {
  141 + this.events.add(event);
  142 + }
  143 +
  144 + public int size()
  145 + {
  146 + return this.events.size();
  147 + }
  148 +
  149 + public Event getHead()
  150 + {
  151 + return this.events.iterator().next();
  152 + }
  153 +
  154 + public void addEventsToHandler(MethodNode handler)
  155 + {
  156 + for (Event event : this.events)
  157 + {
  158 + event.addToHandler(handler);
  159 + }
  160 + }
  161 +
  162 + public boolean isCancellable()
  163 + {
  164 + boolean cancellable = false;
  165 + for (Event event : this.events)
  166 + cancellable |= event.isCancellable();
  167 + return cancellable;
  168 + }
  169 + }
  170 +
  171 + static void addEvent(Event event, String className, String signature, InjectionPoint injectionPoint)
  172 + {
  173 + Map<String, Map<Event, InjectionPoint>> mappings = EventTransformer.eventMappings.get(className);
  174 + if (mappings == null)
  175 + {
  176 + mappings = new HashMap<String, Map<Event, InjectionPoint>>();
  177 + EventTransformer.eventMappings.put(className, mappings);
  178 + }
  179 +
  180 + Map<Event, InjectionPoint> events = mappings.get(signature);
  181 + if (events == null)
  182 + {
  183 + events = new LinkedHashMap<Event, InjectionPoint>();
  184 + mappings.put(signature, events);
  185 + }
  186 +
  187 + events.put(event, injectionPoint);
  188 + }
  189 +
  190 + @Override
  191 + public final byte[] transform(String name, String transformedName, byte[] basicClass)
  192 + {
  193 + if (basicClass != null && EventTransformer.eventMappings.containsKey(transformedName))
  194 + {
  195 + return this.injectEvents(basicClass, EventTransformer.eventMappings.get(transformedName));
  196 + }
  197 +
  198 + return basicClass;
  199 + }
  200 +
  201 + private byte[] injectEvents(byte[] basicClass, Map<String, Map<Event, InjectionPoint>> mappings)
  202 + {
  203 + if (mappings == null) return basicClass;
  204 +
  205 + ClassNode classNode = this.readClass(basicClass, true);
  206 +
  207 + for (MethodNode method : classNode.methods)
  208 + {
  209 + String signature = MethodInfo.generateSignature(method.name, method.desc);
  210 + Map<Event, InjectionPoint> methodInjections = mappings.get(signature);
  211 + if (methodInjections != null)
  212 + {
  213 + this.injectIntoMethod(classNode, signature, method, methodInjections);
  214 + }
  215 + }
  216 +
  217 + if (this.runValidator)
  218 + {
  219 + ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
  220 + classNode.accept(new CheckClassAdapter(writer));
  221 + }
  222 +
  223 + return this.writeClass(classNode);
  224 + }
  225 +
  226 + /**
  227 + * @param classNode
  228 + * @param signature
  229 + * @param method
  230 + * @param methodInjections
  231 + */
  232 + void injectIntoMethod(ClassNode classNode, String signature, MethodNode method, Map<Event, InjectionPoint> methodInjections)
  233 + {
  234 + Map<AbstractInsnNode, Injection> injectionPoints = this.findInjectionPoints(classNode, method, methodInjections);
  235 +
  236 + for (Entry<AbstractInsnNode, Injection> injectionPoint : injectionPoints.entrySet())
  237 + {
  238 + this.injectEventsAt(classNode, method, injectionPoint.getKey(), injectionPoint.getValue());
  239 + }
  240 +
  241 + for (Event event : methodInjections.keySet())
  242 + {
  243 + event.notifyInjected(method.name, method.desc, classNode.name);
  244 + event.detach();
  245 + }
  246 + }
  247 +
  248 + /**
  249 + * @param classNode
  250 + * @param method
  251 + * @param methodInjections
  252 + * @return
  253 + */
  254 + private Map<AbstractInsnNode, Injection> findInjectionPoints(ClassNode classNode, MethodNode method, Map<Event, InjectionPoint> methodInjections)
  255 + {
  256 + ReadOnlyInsnList insns = new ReadOnlyInsnList(method.instructions);
  257 + Collection<AbstractInsnNode> nodes = new ArrayList<AbstractInsnNode>(32);
  258 + Map<AbstractInsnNode, Injection> injectionPoints = new LinkedHashMap<AbstractInsnNode, Injection>();
  259 + for (Entry<Event, InjectionPoint> eventEntry : methodInjections.entrySet())
  260 + {
  261 + Event event = eventEntry.getKey();
  262 + event.attach(method);
  263 + InjectionPoint injectionPoint = eventEntry.getValue();
  264 + nodes.clear();
  265 + if (injectionPoint.find(method.desc, insns, nodes, event))
  266 + {
  267 + for (AbstractInsnNode node : nodes)
  268 + {
  269 + Injection injection = injectionPoints.get(node);
  270 + if (injection == null)
  271 + {
  272 + injection = new Injection(node, injectionPoint.captureLocals());
  273 + injectionPoints.put(node, injection);
  274 + }
  275 + else
  276 + {
  277 + injection.checkCaptureLocals(injectionPoint);
  278 + }
  279 +
  280 + if (injectionPoint.captureLocals() && !injection.hasLocals())
  281 + {
  282 + LocalVariableNode[] locals = ByteCodeUtilities.getLocalsAt(classNode, method, node);
  283 + injection.setLocals(locals);
  284 + if (injectionPoint.logLocals())
  285 + {
  286 + int startPos = ((method.access & Opcodes.ACC_STATIC) == 0 ? 1 : 0) + Type.getArgumentTypes(method.desc).length;
  287 +
  288 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  289 + LiteLoaderLogger.debug("Logging local variables for " + injectionPoint.getClass().getSimpleName());
  290 + for (int i = startPos; i < locals.length; i++)
  291 + {
  292 + LocalVariableNode local = locals[i];
  293 + if (local != null)
  294 + {
  295 + LiteLoaderLogger.debug(" Local[%d] %s %s", i, ByteCodeUtilities.getTypeName(Type.getType(local.desc)), local.name);
  296 + }
  297 + }
  298 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  299 + }
  300 + }
  301 +
  302 + injection.add(event);
  303 + }
  304 + }
  305 + }
  306 +
  307 + return injectionPoints;
  308 + }
  309 +
  310 + /**
  311 + * @param classNode
  312 + * @param method
  313 + * @param injectionPoint
  314 + * @param injection
  315 + */
  316 + private void injectEventsAt(ClassNode classNode, MethodNode method, AbstractInsnNode injectionPoint, Injection injection)
  317 + {
  318 + Event head = injection.getHead();
  319 +
  320 + LiteLoaderLogger.info("Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, ClassTransformer.getSimpleClassName(classNode));
  321 + MethodNode handler = head.inject(injectionPoint, injection.isCancellable(), this.globalEventID, injection.captureLocals(), injection.getLocalTypes());
  322 + injection.addEventsToHandler(handler);
  323 +
  324 + this.globalEventID++;
  325 + }
  326 +
  327 + public static void dumpInjectionState()
  328 + {
  329 + int uninjectedCount = 0;
  330 + int eventCount = 0;
  331 +
  332 + LiteLoaderLogger.debug("EventInjectionTransformer: Injection State");
  333 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  334 + for (Entry<String, Map<String, Map<Event, InjectionPoint>>> mapping : EventTransformer.eventMappings.entrySet())
  335 + {
  336 + LiteLoaderLogger.debug("Class: %s", mapping.getKey());
  337 + for (Entry<String, Map<Event, InjectionPoint>> classMapping : mapping.getValue().entrySet())
  338 + {
  339 + LiteLoaderLogger.debug(" Method: %s", classMapping.getKey());
  340 + for (Event event : classMapping.getValue().keySet())
  341 + {
  342 + uninjectedCount += event.dumpInjectionState();
  343 + eventCount++;
  344 + }
  345 + }
  346 + }
  347 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  348 + LiteLoaderLogger.debug("Listed %d injection candidates with %d uninjected", eventCount, uninjectedCount);
  349 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  350 + }
  351 +}
0 352 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/transformers/event/InjectionPoint.java
... ... @@ -8,6 +8,8 @@ import java.util.List;
8 8 import org.objectweb.asm.tree.AbstractInsnNode;
9 9 import org.objectweb.asm.tree.InsnList;
10 10  
  11 +import com.google.common.base.Joiner;
  12 +
11 13 /**
12 14 * Base class for injection point discovery classes. Each subclass describes a strategy for locating code injection
13 15 * points within a method, with the {@code find} method populating a collection with insn nodes from the method
... ... @@ -26,7 +28,14 @@ import org.objectweb.asm.tree.InsnList;
26 28 * @author Adam Mummery-Smith
27 29 */
28 30 public abstract class InjectionPoint
29   -{
  31 +{
  32 + /**
  33 + * Capture locals as well as args
  34 + */
  35 + protected boolean captureLocals;
  36 +
  37 + protected boolean logLocals;
  38 +
30 39 /**
31 40 * Find injection points in the supplied insn list
32 41 *
... ... @@ -39,6 +48,53 @@ public abstract class InjectionPoint
39 48 public abstract boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event);
40 49  
41 50 /**
  51 + * Set whether this injection point should capture local variables as well as method arguments
  52 + *
  53 + * @param captureLocals
  54 + * @return
  55 + */
  56 + public InjectionPoint setCaptureLocals(boolean captureLocals)
  57 + {
  58 + this.captureLocals = captureLocals;
  59 + return this;
  60 + }
  61 +
  62 + /**
  63 + * Get whether capture locals is enabled
  64 + */
  65 + public boolean captureLocals()
  66 + {
  67 + return this.captureLocals;
  68 + }
  69 +
  70 + /**
  71 + * Since it's virtually impossible to know what locals are available at a given injection point by reading the source, this method causes the
  72 + * injection point to dump the locals to the debug log at injection time.
  73 + *
  74 + * @param logLocals
  75 + * @return
  76 + */
  77 + public InjectionPoint setLogLocals(boolean logLocals)
  78 + {
  79 + this.logLocals = logLocals;
  80 + return this;
  81 + }
  82 +
  83 + /**
  84 + * @return
  85 + */
  86 + public boolean logLocals()
  87 + {
  88 + return this.logLocals;
  89 + }
  90 +
  91 + @Override
  92 + public String toString()
  93 + {
  94 + return "InjectionPoint(" + this.getClass().getSimpleName() + ")";
  95 + }
  96 +
  97 + /**
42 98 * Composite injection point
43 99 *
44 100 * @author Adam Mummery-Smith
... ... @@ -55,6 +111,18 @@ public abstract class InjectionPoint
55 111 }
56 112  
57 113 this.components = components;
  114 +
  115 + for (InjectionPoint component : this.components)
  116 + {
  117 + this.captureLocals |= component.captureLocals;
  118 + this.logLocals |= component.logLocals;
  119 + }
  120 + }
  121 +
  122 + @Override
  123 + public String toString()
  124 + {
  125 + return "CompositeInjectionPoint(" + this.getClass().getSimpleName() + ")[" + Joiner.on(',').join(this.components) + "]";
58 126 }
59 127 }
60 128  
... ... @@ -139,6 +207,36 @@ public abstract class InjectionPoint
139 207 }
140 208  
141 209 @Override
  210 + public InjectionPoint setCaptureLocals(boolean captureLocals)
  211 + {
  212 + return this.input.setCaptureLocals(captureLocals);
  213 + }
  214 +
  215 + @Override
  216 + public boolean captureLocals()
  217 + {
  218 + return this.input.captureLocals();
  219 + }
  220 +
  221 + @Override
  222 + public InjectionPoint setLogLocals(boolean logLocals)
  223 + {
  224 + return this.input.setLogLocals(logLocals);
  225 + }
  226 +
  227 + @Override
  228 + public boolean logLocals()
  229 + {
  230 + return this.input.logLocals();
  231 + }
  232 +
  233 + @Override
  234 + public String toString()
  235 + {
  236 + return "InjectionPoint(" + this.getClass().getSimpleName() + ")[" + this.input + "]";
  237 + }
  238 +
  239 + @Override
142 240 public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
143 241 {
144 242 List<AbstractInsnNode> list = (nodes instanceof List) ? (List<AbstractInsnNode>)nodes : new ArrayList<AbstractInsnNode>(nodes);
... ...
java/common/com/mumfrey/liteloader/transformers/event/MethodInfo.java
... ... @@ -77,6 +77,17 @@ public class MethodInfo
77 77 }
78 78  
79 79 /**
  80 + * Create a MethodInfo for the specified class and method name
  81 + *
  82 + * @param owner Owner name descriptor
  83 + * @param method Literal method name
  84 + */
  85 + public MethodInfo(Obf owner, Obf method)
  86 + {
  87 + this(owner.name, owner.obf, method.name, method.srg, method.obf, null, null);
  88 + }
  89 +
  90 + /**
80 91 * Create a MethodInfo for the specified class, literal method name and literal descriptor
81 92 *
82 93 * @param owner Owner name descriptor
... ...
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeFieldAccess.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.inject;
  2 +
  3 +import org.objectweb.asm.tree.AbstractInsnNode;
  4 +import org.objectweb.asm.tree.FieldInsnNode;
  5 +
  6 +/**
  7 + * An injection point which searches for GETFIELD and SETFIELD opcodes matching its arguments and returns a list of insns
  8 + * immediately prior to matching instructions. Only the field name is required, owners and signatures are optional and can
  9 + * be used to disambiguate between fields of the same name but with different types, or belonging to different classes.
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public class BeforeFieldAccess extends BeforeInvoke
  14 +{
  15 + private final int opcode;
  16 +
  17 + public BeforeFieldAccess(int opcode, String... fieldNames)
  18 + {
  19 + super(fieldNames);
  20 + this.opcode = opcode;
  21 + }
  22 +
  23 + public BeforeFieldAccess(int opcode, String fieldName, int ordinal)
  24 + {
  25 + super(fieldName, ordinal);
  26 + this.opcode = opcode;
  27 + }
  28 +
  29 + public BeforeFieldAccess(int opcode, String[] fieldNames, int ordinal)
  30 + {
  31 + super(fieldNames, ordinal);
  32 + this.opcode = opcode;
  33 + }
  34 +
  35 + public BeforeFieldAccess(int opcode, String[] fieldNames, String[] fieldOwners)
  36 + {
  37 + super(fieldNames, fieldOwners);
  38 + this.opcode = opcode;
  39 + }
  40 +
  41 + public BeforeFieldAccess(int opcode, String[] fieldNames, String[] fieldOwners, int ordinal)
  42 + {
  43 + super(fieldNames, fieldOwners, ordinal);
  44 + this.opcode = opcode;
  45 + }
  46 +
  47 + public BeforeFieldAccess(int opcode, String[] fieldNames, String[] fieldOwners, String[] methodSignatures)
  48 + {
  49 + super(fieldNames, fieldOwners, methodSignatures);
  50 + this.opcode = opcode;
  51 + }
  52 +
  53 + public BeforeFieldAccess(int opcode, String[] fieldNames, String[] fieldOwners, String[] fieldSignatures, int ordinal)
  54 + {
  55 + super(fieldNames, fieldOwners, fieldSignatures, ordinal);
  56 + this.opcode = opcode;
  57 + }
  58 +
  59 +// public BeforeFieldAccess(MethodInfo fieldInfo)
  60 +// {
  61 +// super(fieldInfo);
  62 +// }
  63 +//
  64 +// public BeforeFieldAccess(MethodInfo fieldInfo, int ordinal)
  65 +// {
  66 +// super(fieldInfo, ordinal);
  67 +// }
  68 +
  69 + @Override
  70 + protected boolean matchesInsn(AbstractInsnNode insn)
  71 + {
  72 + return insn instanceof FieldInsnNode && ((FieldInsnNode)insn).getOpcode() == this.opcode;
  73 + }
  74 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeInvoke.java
... ... @@ -4,9 +4,11 @@ import java.util.Collection;
4 4 import java.util.ListIterator;
5 5  
6 6 import org.objectweb.asm.tree.AbstractInsnNode;
  7 +import org.objectweb.asm.tree.FieldInsnNode;
7 8 import org.objectweb.asm.tree.InsnList;
8 9 import org.objectweb.asm.tree.MethodInsnNode;
9 10  
  11 +import com.mumfrey.liteloader.transformers.ClassTransformer;
10 12 import com.mumfrey.liteloader.transformers.event.Event;
11 13 import com.mumfrey.liteloader.transformers.event.InjectionPoint;
12 14 import com.mumfrey.liteloader.transformers.event.MethodInfo;
... ... @@ -21,6 +23,35 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
21 23 */
22 24 public class BeforeInvoke extends InjectionPoint
23 25 {
  26 + protected class InsnInfo
  27 + {
  28 + public final String owner;
  29 + public final String name;
  30 + public final String desc;
  31 +
  32 + public InsnInfo(AbstractInsnNode insn)
  33 + {
  34 + if (insn instanceof MethodInsnNode)
  35 + {
  36 + MethodInsnNode methodNode = (MethodInsnNode)insn;
  37 + this.owner = methodNode.owner;
  38 + this.name = methodNode.name;
  39 + this.desc = methodNode.desc;
  40 + }
  41 + else if (insn instanceof FieldInsnNode)
  42 + {
  43 + FieldInsnNode fieldNode = (FieldInsnNode)insn;
  44 + this.owner = fieldNode.owner;
  45 + this.name = fieldNode.name;
  46 + this.desc = fieldNode.desc;
  47 + }
  48 + else
  49 + {
  50 + throw new IllegalArgumentException("insn must be an instance of MethodInsnNode or FieldInsnNode");
  51 + }
  52 + }
  53 + }
  54 +
24 55 /**
25 56 * Method name(s) to search for, usually this will contain the different names of the method for different obfuscations (mcp, srg, notch)
26 57 */
... ... @@ -49,6 +80,8 @@ public class BeforeInvoke extends InjectionPoint
49 80 */
50 81 protected boolean logging = false;
51 82  
  83 + protected final String className;
  84 +
52 85 /**
53 86 * Match all occurrences of the specified method or methods
54 87 *
... ... @@ -151,6 +184,9 @@ public class BeforeInvoke extends InjectionPoint
151 184 this.methodOwners = methodOwners;
152 185 this.methodSignatures = methodSignatures;
153 186 this.ordinal = ordinal;
  187 + this.className = this.getClass().getSimpleName();
  188 +
  189 + this.convertClassRefs();
154 190 }
155 191  
156 192 /**
... ... @@ -175,7 +211,13 @@ public class BeforeInvoke extends InjectionPoint
175 211 this.methodOwners = method.getOwners();
176 212 this.methodSignatures = method.getDescriptors();
177 213 this.ordinal = ordinal;
  214 + this.className = this.getClass().getSimpleName();
178 215  
  216 + this.convertClassRefs();
  217 + }
  218 +
  219 + private void convertClassRefs()
  220 + {
179 221 for (int i = 0; i < this.methodOwners.length; i++)
180 222 {
181 223 if (this.methodOwners[i] != null) this.methodOwners[i] = this.methodOwners[i].replace('.', '/');
... ... @@ -204,8 +246,8 @@ public class BeforeInvoke extends InjectionPoint
204 246  
205 247 if (this.logging)
206 248 {
207   - LiteLoaderLogger.debug("================================================================================");
208   - LiteLoaderLogger.debug("BeforeInvoke is searching for an injection point in method with descriptor %s", desc);
  249 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  250 + LiteLoaderLogger.debug(this.className + " is searching for an injection point in method with descriptor %s", desc);
209 251 }
210 252  
211 253 ListIterator<AbstractInsnNode> iter = insns.iterator();
... ... @@ -213,24 +255,24 @@ public class BeforeInvoke extends InjectionPoint
213 255 {
214 256 AbstractInsnNode insn = iter.next();
215 257  
216   - if (insn instanceof MethodInsnNode)
  258 + if (this.matchesInsn(insn))
217 259 {
218   - MethodInsnNode node = (MethodInsnNode)insn;
  260 + InsnInfo nodeInfo = new InsnInfo(insn);
219 261  
220   - if (this.logging) LiteLoaderLogger.debug("BeforeInvoke is considering invokation NAME=%s DESC=%s OWNER=%s", node.name, node.desc, node.owner);
  262 + if (this.logging) LiteLoaderLogger.debug(this.className + " is considering insn NAME=%s DESC=%s OWNER=%s", nodeInfo.name, nodeInfo.desc, nodeInfo.owner);
221 263  
222   - int index = BeforeInvoke.arrayIndexOf(this.methodNames, node.name, -1);
223   - if (index > -1 && this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke, checking owner/signature...");
  264 + int index = BeforeInvoke.arrayIndexOf(this.methodNames, nodeInfo.name, -1);
  265 + if (index > -1 && this.logging) LiteLoaderLogger.debug(this.className + " found a matching insn, checking owner/signature...");
224 266  
225   - int ownerIndex = BeforeInvoke.arrayIndexOf(this.methodOwners, node.owner, index);
226   - int descIndex = BeforeInvoke.arrayIndexOf(this.methodSignatures, node.desc, index);
  267 + int ownerIndex = BeforeInvoke.arrayIndexOf(this.methodOwners, nodeInfo.owner, index);
  268 + int descIndex = BeforeInvoke.arrayIndexOf(this.methodSignatures, nodeInfo.desc, index);
227 269 if (index > -1 && ownerIndex == index && descIndex == index)
228 270 {
229   - if (this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke, checking preconditions...");
230   - if (this.matchesInsn(node, ordinal))
  271 + if (this.logging) LiteLoaderLogger.debug(this.className + " found a matching insn, checking preconditions...");
  272 + if (this.matchesInsn(nodeInfo, ordinal))
231 273 {
232   - if (this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke at ordinal %d", ordinal);
233   - nodes.add(node);
  274 + if (this.logging) LiteLoaderLogger.debug(this.className + " found a matching insn at ordinal %d", ordinal);
  275 + nodes.add(insn);
234 276 found = true;
235 277  
236 278 if (this.ordinal == ordinal)
... ... @@ -244,19 +286,24 @@ public class BeforeInvoke extends InjectionPoint
244 286 this.inspectInsn(desc, insns, insn);
245 287 }
246 288  
247   - if (this.logging) LiteLoaderLogger.debug("================================================================================");
  289 + if (this.logging) LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
248 290  
249 291 return found;
250 292 }
251 293  
  294 + protected boolean matchesInsn(AbstractInsnNode insn)
  295 + {
  296 + return insn instanceof MethodInsnNode;
  297 + }
  298 +
252 299 protected void inspectInsn(String desc, InsnList insns, AbstractInsnNode insn)
253 300 {
254 301 // stub for subclasses
255 302 }
256 303  
257   - protected boolean matchesInsn(MethodInsnNode node, int ordinal)
  304 + protected boolean matchesInsn(InsnInfo nodeInfo, int ordinal)
258 305 {
259   - if (this.logging) LiteLoaderLogger.debug("BeforeInvoke comparing target ordinal %d with current ordinal %d", this.ordinal, ordinal);
  306 + if (this.logging) LiteLoaderLogger.debug(this.className + " comparing target ordinal %d with current ordinal %d", this.ordinal, ordinal);
260 307 return this.ordinal == -1 || this.ordinal == ordinal;
261 308 }
262 309  
... ...
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeNew.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.inject;
  2 +
  3 +import java.util.Collection;
  4 +import java.util.ListIterator;
  5 +
  6 +import org.objectweb.asm.Opcodes;
  7 +import org.objectweb.asm.tree.AbstractInsnNode;
  8 +import org.objectweb.asm.tree.InsnList;
  9 +import org.objectweb.asm.tree.TypeInsnNode;
  10 +
  11 +import com.mumfrey.liteloader.core.runtime.Obf;
  12 +import com.mumfrey.liteloader.transformers.event.Event;
  13 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  14 +
  15 +public class BeforeNew extends InjectionPoint
  16 +{
  17 + private final String[] classNames;
  18 +
  19 + private final int ordinal;
  20 +
  21 + public BeforeNew(Obf className)
  22 + {
  23 + this(-1, className.names);
  24 + }
  25 +
  26 + public BeforeNew(String... classNames)
  27 + {
  28 + this(-1, classNames);
  29 + }
  30 +
  31 + public BeforeNew(int ordinal, Obf className)
  32 + {
  33 + this(ordinal, className.names);
  34 + }
  35 +
  36 + public BeforeNew(int ordinal, String... classNames)
  37 + {
  38 + this.ordinal = Math.max(-1, ordinal);
  39 + this.classNames = classNames;
  40 +
  41 + for (int i = 0; i < this.classNames.length; i++)
  42 + {
  43 + this.classNames[i] = this.classNames[i].replace('.', '/');
  44 + }
  45 + }
  46 +
  47 + @Override
  48 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  49 + {
  50 + boolean found = false;
  51 + int ordinal = 0;
  52 +
  53 + ListIterator<AbstractInsnNode> iter = insns.iterator();
  54 + while (iter.hasNext())
  55 + {
  56 + AbstractInsnNode insn = iter.next();
  57 +
  58 + if (insn instanceof TypeInsnNode && insn.getOpcode() == Opcodes.NEW && this.matchesOwner((TypeInsnNode)insn))
  59 + {
  60 + if (this.ordinal == -1 || this.ordinal == ordinal)
  61 + {
  62 + nodes.add(insn);
  63 + found = true;
  64 + }
  65 +
  66 + ordinal++;
  67 + }
  68 + }
  69 +
  70 + return found;
  71 + }
  72 +
  73 + private boolean matchesOwner(TypeInsnNode insn)
  74 + {
  75 + for (String className : this.classNames)
  76 + {
  77 + if (className.equals(insn.desc)) return true;
  78 + }
  79 +
  80 + return false;
  81 + }
  82 +
  83 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeStringInvoke.java
... ... @@ -5,7 +5,6 @@ import java.util.Collection;
5 5 import org.objectweb.asm.tree.AbstractInsnNode;
6 6 import org.objectweb.asm.tree.InsnList;
7 7 import org.objectweb.asm.tree.LdcInsnNode;
8   -import org.objectweb.asm.tree.MethodInsnNode;
9 8  
10 9 import com.mumfrey.liteloader.transformers.event.Event;
11 10 import com.mumfrey.liteloader.transformers.event.MethodInfo;
... ... @@ -65,9 +64,9 @@ public class BeforeStringInvoke extends BeforeInvoke
65 64 }
66 65  
67 66 @Override
68   - protected boolean matchesInsn(MethodInsnNode node, int ordinal)
  67 + protected boolean matchesInsn(InsnInfo nodeInfo, int ordinal)
69 68 {
70 69 if (this.logging) LiteLoaderLogger.debug("BeforeInvoke foundLdc \"%s\" = %s", this.ldcValue, this.foundLdc);
71   - return this.foundLdc && super.matchesInsn(node, ordinal);
  70 + return this.foundLdc && super.matchesInsn(nodeInfo, ordinal);
72 71 }
73 72 }
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/InvalidEventJsonException.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +public class InvalidEventJsonException extends RuntimeException
  4 +{
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public InvalidEventJsonException()
  8 + {
  9 + }
  10 +
  11 + public InvalidEventJsonException(String message)
  12 + {
  13 + super(message);
  14 + }
  15 +
  16 + public InvalidEventJsonException(Throwable cause)
  17 + {
  18 + super(cause);
  19 + }
  20 +
  21 + public InvalidEventJsonException(String message, Throwable cause)
  22 + {
  23 + super(message, cause);
  24 + }
  25 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonDescriptor.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.UUID;
  5 +
  6 +import com.google.gson.annotations.SerializedName;
  7 +import com.mumfrey.liteloader.core.runtime.Obf;
  8 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  9 +
  10 +public class JsonDescriptor implements Serializable
  11 +{
  12 + private static final long serialVersionUID = 1L;
  13 +
  14 + @SerializedName("key")
  15 + private String key;
  16 +
  17 + @SerializedName("owner")
  18 + private String owner;
  19 +
  20 + @SerializedName("name")
  21 + private String name;
  22 +
  23 + @SerializedName("return")
  24 + private String returnType;
  25 +
  26 + @SerializedName("args")
  27 + private String[] argumentTypes;
  28 +
  29 + public String getKey()
  30 + {
  31 + if (this.key == null)
  32 + {
  33 + this.key = "UserDescriptor" + UUID.randomUUID().toString();
  34 + }
  35 +
  36 + return this.key;
  37 + }
  38 +
  39 + public MethodInfo parse(JsonObfuscationTable obfTable)
  40 + {
  41 + if (this.owner == null || this.name == null)
  42 + {
  43 + throw new InvalidEventJsonException("Method descriptor was invalid, must specify owner and name!");
  44 + }
  45 +
  46 + Obf owner = obfTable.parseClass(this.owner);
  47 + Obf name = obfTable.parseMethod(this.name);
  48 +
  49 + if (this.returnType == null)
  50 + {
  51 + if (this.argumentTypes != null)
  52 + {
  53 + throw new InvalidEventJsonException("Method descriptor was invalid, args specified with no return type!");
  54 + }
  55 +
  56 + return new MethodInfo(owner, name);
  57 + }
  58 +
  59 + Object returnType = obfTable.parseType(this.returnType);
  60 + Object[] args = (this.argumentTypes != null ? new Object[this.argumentTypes.length] : new Object[0]);
  61 + for (int arg = 0; arg < this.argumentTypes.length; arg++)
  62 + {
  63 + args[arg] = obfTable.parseType(this.argumentTypes[arg]);
  64 + }
  65 +
  66 + return new MethodInfo(owner, name, returnType, args);
  67 + }
  68 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonEvent.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +
  7 +import com.google.gson.annotations.SerializedName;
  8 +import com.mumfrey.liteloader.transformers.event.Event;
  9 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  10 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  11 +
  12 +public class JsonEvent implements Serializable
  13 +{
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + private static int nextEventID = 0;
  17 +
  18 + @SerializedName("name")
  19 + private String name;
  20 +
  21 + @SerializedName("cancellable")
  22 + private boolean cancellable;
  23 +
  24 + @SerializedName("priority")
  25 + private int priority = 1000;
  26 +
  27 + @SerializedName("injections")
  28 + private List<JsonInjection> jsonInjections;
  29 +
  30 + @SerializedName("listeners")
  31 + private List<String> jsonListeners;
  32 +
  33 + private transient List<MethodInfo> listeners = new ArrayList<MethodInfo>();
  34 +
  35 + public String getName()
  36 + {
  37 + if (this.name == null)
  38 + {
  39 + this.name = "onUserEvent" + (JsonEvent.nextEventID++);
  40 + }
  41 +
  42 + return this.name;
  43 + }
  44 +
  45 + public boolean isCancellable()
  46 + {
  47 + return this.cancellable;
  48 + }
  49 +
  50 + public int getPriority()
  51 + {
  52 + return this.priority;
  53 + }
  54 +
  55 + public List<MethodInfo> getListeners()
  56 + {
  57 + return this.listeners;
  58 + }
  59 +
  60 + public void parse(JsonEvents json)
  61 + {
  62 + this.parseInjectionPoints(json);
  63 + this.parseListeners(json);
  64 + }
  65 +
  66 + private void parseInjectionPoints(JsonEvents json)
  67 + {
  68 + if (this.jsonInjections == null || this.jsonInjections.size() == 0)
  69 + {
  70 + throw new InvalidEventJsonException("Event " + this.getName() + " does not have any defined injections");
  71 + }
  72 +
  73 + for (JsonInjection injection : this.jsonInjections)
  74 + {
  75 + injection.parse(json);
  76 + }
  77 + }
  78 +
  79 + private void parseListeners(JsonEvents json)
  80 + {
  81 + if (this.jsonListeners == null || this.jsonListeners.size() == 0)
  82 + {
  83 + throw new InvalidEventJsonException("Event " + this.getName() + " does not have any defined listeners");
  84 + }
  85 +
  86 + for (String listener : this.jsonListeners)
  87 + {
  88 + this.listeners.add(json.getMethod(listener));
  89 + }
  90 + }
  91 + public Event register(ModEventInjectionTransformer transformer)
  92 + {
  93 + Event event = Event.getOrCreate(this.getName(), this.isCancellable(), this.getPriority());
  94 +
  95 + for (JsonInjection injection : this.jsonInjections)
  96 + {
  97 + MethodInfo targetMethod = injection.getMethod();
  98 + InjectionPoint injectionPoint = injection.getInjectionPoint();
  99 +
  100 + transformer.registerEvent(event, targetMethod, injectionPoint);
  101 + }
  102 +
  103 + for (MethodInfo listener : this.listeners)
  104 + {
  105 + event.addListener(listener);
  106 + }
  107 +
  108 + return event;
  109 + }
  110 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonEvents.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +import java.util.regex.Matcher;
  8 +import java.util.regex.Pattern;
  9 +
  10 +import com.google.gson.Gson;
  11 +import com.google.gson.GsonBuilder;
  12 +import com.google.gson.annotations.SerializedName;
  13 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  14 +
  15 +/**
  16 + * Serialisable class which represents a set of event injection definitions
  17 + *
  18 + * @author Adam Mummery-Smith
  19 + */
  20 +public class JsonEvents implements Serializable
  21 +{
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
  25 +
  26 + private static final Pattern tokenPattern = Pattern.compile("^\\$\\{([a-zA-Z0-9_\\-\\.\\$]+)\\}$");
  27 +
  28 + @SerializedName("obfuscation")
  29 + private JsonObfuscationTable obfuscation;
  30 +
  31 + @SerializedName("descriptors")
  32 + private List<JsonDescriptor> descriptors;
  33 +
  34 + @SerializedName("events")
  35 + private List<JsonEvent> events;
  36 +
  37 + private transient Map<String, MethodInfo> methods = new HashMap<String, MethodInfo>();
  38 +
  39 + public void parse()
  40 + {
  41 + try
  42 + {
  43 + this.obfuscation.parse();
  44 +
  45 + if (this.descriptors != null)
  46 + {
  47 + for (JsonDescriptor descriptor : this.descriptors)
  48 + {
  49 + this.methods.put(descriptor.getKey(), descriptor.parse(this.obfuscation));
  50 + }
  51 + }
  52 +
  53 + for (JsonEvent event : this.events)
  54 + {
  55 + event.parse(this);
  56 + }
  57 + }
  58 + catch (InvalidEventJsonException ex)
  59 + {
  60 + throw ex;
  61 + }
  62 + catch (Exception ex)
  63 + {
  64 + throw new InvalidEventJsonException("An error occurred whilst parsing the event definition: " + ex.getClass().getSimpleName() + ": " + ex.getMessage(), ex);
  65 + }
  66 + }
  67 +
  68 + public void register(ModEventInjectionTransformer transformer)
  69 + {
  70 + for (JsonEvent event : this.events)
  71 + {
  72 + event.register(transformer);
  73 + }
  74 + }
  75 +
  76 + public MethodInfo getMethod(String token)
  77 + {
  78 + String key = JsonEvents.parseToken(token);
  79 + if (key == null)
  80 + {
  81 + throw new InvalidEventJsonException("\"" + token + "\" is not a valid token");
  82 + }
  83 +
  84 + MethodInfo method = this.methods.get(key);
  85 + if (method == null)
  86 + {
  87 + throw new InvalidEventJsonException("Could not locate method with token " + token);
  88 + }
  89 + return method;
  90 + }
  91 +
  92 + public String toJson()
  93 + {
  94 + return JsonEvents.gson.toJson(this);
  95 + }
  96 +
  97 + public static JsonEvents parse(String json)
  98 + {
  99 + JsonEvents newJsonEvents = JsonEvents.gson.fromJson(json, JsonEvents.class);
  100 + newJsonEvents.parse();
  101 + return newJsonEvents;
  102 + }
  103 +
  104 + protected static String parseToken(String token)
  105 + {
  106 + token = token.replace(" ", "").trim();
  107 +
  108 + Matcher tokenPatternMatcher = JsonEvents.tokenPattern.matcher(token);
  109 + if (tokenPatternMatcher.matches())
  110 + {
  111 + return tokenPatternMatcher.group(1);
  112 + }
  113 +
  114 + return null;
  115 + }
  116 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonInjection.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.lang.reflect.Constructor;
  5 +
  6 +import com.google.gson.annotations.SerializedName;
  7 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  8 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  9 +import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
  10 +import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
  11 +import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
  12 +
  13 +public class JsonInjection implements Serializable
  14 +{
  15 + private static final long serialVersionUID = 1L;
  16 +
  17 + @SerializedName("method")
  18 + private String methodName;
  19 +
  20 + @SerializedName("type")
  21 + private JsonInjectionType type;
  22 +
  23 + @SerializedName("shift")
  24 + private JsonInjectionShiftType shift;
  25 +
  26 + @SerializedName("target")
  27 + private String target;
  28 +
  29 + @SerializedName("ordinal")
  30 + private int ordinal = -1;
  31 +
  32 + @SerializedName("class")
  33 + private String className;
  34 +
  35 + @SerializedName("args")
  36 + private Object[] args;
  37 +
  38 + private transient MethodInfo method;
  39 +
  40 + private transient InjectionPoint injectionPoint;
  41 +
  42 + public MethodInfo getMethod()
  43 + {
  44 + return this.method;
  45 + }
  46 +
  47 + public InjectionPoint getInjectionPoint()
  48 + {
  49 + return this.injectionPoint;
  50 + }
  51 +
  52 + public void parse(JsonEvents json)
  53 + {
  54 + this.method = this.parseMethod(json);
  55 + this.injectionPoint = this.parseInjectionPoint(json);
  56 + }
  57 +
  58 + private MethodInfo parseMethod(JsonEvents json)
  59 + {
  60 + return json.getMethod(this.methodName);
  61 + }
  62 +
  63 + public InjectionPoint parseInjectionPoint(JsonEvents json)
  64 + {
  65 + switch (this.type)
  66 + {
  67 + case INVOKE:
  68 + MethodInfo method = json.getMethod(this.getTarget());
  69 + return this.applyShift(new BeforeInvoke(method, this.ordinal));
  70 +
  71 + case RETURN:
  72 + return this.applyShift(new BeforeReturn(this.ordinal));
  73 +
  74 + case HEAD:
  75 + return new MethodHead();
  76 +
  77 + case CUSTOM:
  78 + try
  79 + {
  80 + @SuppressWarnings("unchecked")
  81 + Class<InjectionPoint> injectionPointClass = (Class<InjectionPoint>)Class.forName(this.className);
  82 + if (this.args != null)
  83 + {
  84 + Constructor<InjectionPoint> ctor = injectionPointClass.getDeclaredConstructor(Object[].class);
  85 + return ctor.newInstance(this.args);
  86 + }
  87 + return injectionPointClass.newInstance();
  88 + }
  89 + catch (Exception ex)
  90 + {
  91 + throw new RuntimeException(ex);
  92 + }
  93 + }
  94 +
  95 + throw new InvalidEventJsonException("Could not parse injection type");
  96 + }
  97 +
  98 + private String getTarget()
  99 + {
  100 + if (this.target != null && this.shift == null)
  101 + {
  102 + if (this.target.startsWith("before(") && this.target.endsWith(")"))
  103 + {
  104 + this.target = this.target.substring(7, this.target.length() - 8);
  105 + this.shift = JsonInjectionShiftType.BEFORE;
  106 + }
  107 + else if (this.target.startsWith("after(") && this.target.endsWith(")"))
  108 + {
  109 + this.target = this.target.substring(6, this.target.length() - 7);
  110 + this.shift = JsonInjectionShiftType.AFTER;
  111 + }
  112 + }
  113 +
  114 + return this.target;
  115 + }
  116 +
  117 + private InjectionPoint applyShift(InjectionPoint injectionPoint)
  118 + {
  119 + if (this.shift != null)
  120 + {
  121 + switch (this.shift)
  122 + {
  123 + case AFTER:
  124 + return InjectionPoint.after(injectionPoint);
  125 +
  126 + case BEFORE:
  127 + return InjectionPoint.before(injectionPoint);
  128 + }
  129 + }
  130 +
  131 + return injectionPoint;
  132 + }
  133 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonInjectionShiftType.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +public enum JsonInjectionShiftType
  4 +{
  5 + BEFORE,
  6 + AFTER
  7 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonInjectionType.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +public enum JsonInjectionType
  4 +{
  5 + INVOKE,
  6 + RETURN,
  7 + HEAD,
  8 + CUSTOM;
  9 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonObf.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.UUID;
  5 +
  6 +import com.google.gson.annotations.SerializedName;
  7 +import com.mumfrey.liteloader.core.runtime.Obf;
  8 +
  9 +public class JsonObf implements Serializable
  10 +{
  11 + private static final long serialVersionUID = 1L;
  12 +
  13 + @SerializedName("key")
  14 + private String key;
  15 +
  16 + @SerializedName("mcp")
  17 + private String mcp;
  18 +
  19 + @SerializedName("srg")
  20 + private String srg;
  21 +
  22 + @SerializedName("obf")
  23 + private String obf;
  24 +
  25 + public String getKey()
  26 + {
  27 + if (this.key == null)
  28 + {
  29 + this.key = "UserObfuscationMapping" + UUID.randomUUID().toString();
  30 + }
  31 +
  32 + return this.key;
  33 + }
  34 +
  35 + public Obf parse()
  36 + {
  37 + String seargeName = this.getFirstValidEntry(this.srg, this.mcp, this.obf, this.getKey());
  38 + String obfName = this.getFirstValidEntry(this.obf, this.srg, this.mcp, this.getKey());
  39 + String mcpName = this.getFirstValidEntry(this.mcp, this.srg, this.obf, this.getKey());
  40 +
  41 + return new Mapping(seargeName, obfName, mcpName);
  42 + }
  43 +
  44 + private String getFirstValidEntry(String... entries)
  45 + {
  46 + for (String entry : entries)
  47 + {
  48 + if (entry != null) return entry;
  49 + }
  50 +
  51 + throw new InvalidEventJsonException("No valid entry found in list!");
  52 + }
  53 +
  54 + public static class Mapping extends Obf
  55 + {
  56 + protected Mapping(String seargeName, String obfName, String mcpName)
  57 + {
  58 + super(seargeName, obfName, mcpName);
  59 + }
  60 + }
  61 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/JsonObfuscationTable.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +import com.google.gson.annotations.SerializedName;
  9 +import com.mumfrey.liteloader.core.runtime.Obf;
  10 +import com.mumfrey.liteloader.core.runtime.Packets;
  11 +
  12 +public class JsonObfuscationTable implements Serializable
  13 +{
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + @SerializedName("classes")
  17 + private List<JsonObf> jsonClasses;
  18 +
  19 + @SerializedName("methods")
  20 + private List<JsonObf> jsonMethods;
  21 +
  22 + @SerializedName("fields")
  23 + private List<JsonObf> jsonFields;
  24 +
  25 + private transient Map<String, Obf> classObfs = new HashMap<String, Obf>();
  26 + private transient Map<String, Obf> methodObfs = new HashMap<String, Obf>();
  27 + private transient Map<String, Obf> fieldObfs = new HashMap<String, Obf>();
  28 +
  29 + public void parse()
  30 + {
  31 + if (this.jsonClasses != null)
  32 + {
  33 + for (JsonObf jsonClass : this.jsonClasses)
  34 + {
  35 + this.classObfs.put(jsonClass.getKey(), jsonClass.parse());
  36 + }
  37 + }
  38 +
  39 + if (this.jsonMethods != null)
  40 + {
  41 + for (JsonObf jsonMethod : this.jsonMethods)
  42 + {
  43 + this.methodObfs.put(jsonMethod.getKey(), jsonMethod.parse());
  44 + }
  45 + }
  46 +
  47 + if (this.jsonFields != null)
  48 + {
  49 + for (JsonObf jsonField : this.jsonFields)
  50 + {
  51 + this.fieldObfs.put(jsonField.getKey(), jsonField.parse());
  52 + }
  53 + }
  54 + }
  55 +
  56 + public Object parseType(String token)
  57 + {
  58 + token = token.replace(" ", "").trim();
  59 +
  60 + if ("I".equals(token) || "INT".equals(token)) return Integer.TYPE;
  61 + if ("J".equals(token) || "LONG".equals(token)) return Long.TYPE;
  62 + if ("V".equals(token) || "VOID".equals(token)) return Void.TYPE;
  63 + if ("Z".equals(token) || "BOOLEAN".equals(token) || "BOOL".equals(token)) return Boolean.TYPE;
  64 + if ("B".equals(token) || "BYTE".equals(token)) return Byte.TYPE;
  65 + if ("C".equals(token) || "CHAR".equals(token)) return Character.TYPE;
  66 + if ("S".equals(token) || "SHORT".equals(token)) return Short.TYPE;
  67 + if ("D".equals(token) || "DOUBLE".equals(token)) return Double.TYPE;
  68 + if ("F".equals(token) || "FLOAT".equals(token)) return Float.TYPE;
  69 + if ("STRING".equals(token)) return String.class;
  70 +
  71 + if (token.startsWith("L") && token.endsWith(";"))
  72 + {
  73 + token = token.substring(1, token.length() - 1).replace('/', '.');
  74 + }
  75 +
  76 + return this.parseClass(token);
  77 + }
  78 +
  79 + public Obf parseClass(String token)
  80 + {
  81 + return this.parseObf(token, this.classObfs);
  82 + }
  83 +
  84 + public Obf parseMethod(String token)
  85 + {
  86 + return this.parseObf(token, this.methodObfs);
  87 + }
  88 +
  89 + public Obf parseField(String token)
  90 + {
  91 + return this.parseObf(token, this.fieldObfs);
  92 + }
  93 +
  94 + /**
  95 + * @param token
  96 + * @param obfs
  97 + * @return
  98 + */
  99 + private Obf parseObf(String token, Map<String, Obf> obfs)
  100 + {
  101 + String key = JsonEvents.parseToken(token);
  102 +
  103 + if (key != null)
  104 + {
  105 + if (obfs.containsKey(key))
  106 + {
  107 + return obfs.get(key);
  108 + }
  109 +
  110 + Obf obf = Obf.getByName(key);
  111 + if (obf != null)
  112 + {
  113 + return obf;
  114 + }
  115 +
  116 + Packets packet = Packets.getByName(key);
  117 + if (packet != null)
  118 + {
  119 + return packet;
  120 + }
  121 +
  122 + throw new InvalidEventJsonException("The token " + token + " could not be resolved");
  123 + }
  124 +
  125 + return new JsonObf.Mapping(token, token, token);
  126 + }
  127 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/ModEventInjectionTransformer.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.util.Map.Entry;
  4 +
  5 +import com.mumfrey.liteloader.transformers.ClassTransformer;
  6 +import com.mumfrey.liteloader.transformers.event.Event;
  7 +import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
  8 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  9 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  10 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  11 +
  12 +/**
  13 + * Event transformer which manages injections of mod events specified via events.json in the mod container
  14 + *
  15 + * @author Adam Mummery-Smith
  16 + */
  17 +public class ModEventInjectionTransformer extends EventInjectionTransformer
  18 +{
  19 + @Override
  20 + protected void addEvents()
  21 + {
  22 + for (Entry<String, String> eventsDefinition : ModEvents.getEvents().entrySet())
  23 + {
  24 + String identifier = eventsDefinition.getKey();
  25 + String json = eventsDefinition.getValue();
  26 +
  27 + this.addEvents(identifier, json);
  28 + }
  29 + }
  30 +
  31 + /**
  32 + * @param identifier
  33 + * @param json
  34 + */
  35 + private void addEvents(String identifier, String json)
  36 + {
  37 + JsonEvents events = null;
  38 +
  39 + try
  40 + {
  41 + LiteLoaderLogger.info("Parsing events for mod with id %s", identifier);
  42 + events = JsonEvents.parse(json);
  43 + events.register(this);
  44 + }
  45 + catch (InvalidEventJsonException ex)
  46 + {
  47 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  48 + LiteLoaderLogger.debug(ex.getMessage());
  49 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  50 + LiteLoaderLogger.debug(json);
  51 + LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
  52 + LiteLoaderLogger.severe(ex, "Invalid JSON event declarations for mod with id %s", identifier);
  53 + }
  54 + catch (Throwable ex)
  55 + {
  56 + LiteLoaderLogger.severe(ex, "Error whilst parsing event declarations for mod with id %s", identifier);
  57 + }
  58 +
  59 + try
  60 + {
  61 + if (events != null)
  62 + {
  63 + LiteLoaderLogger.info("Registering events for mod with id %s", identifier);
  64 + events.register(this);
  65 + }
  66 + }
  67 + catch (Throwable ex)
  68 + {
  69 + LiteLoaderLogger.severe(ex, "Error whilst parsing event declarations for mod with id %s", identifier);
  70 + }
  71 + }
  72 +
  73 + protected Event registerEvent(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint)
  74 + {
  75 + return super.addEvent(event, targetMethod, injectionPoint);
  76 + }
  77 +}
... ...
java/common/com/mumfrey/liteloader/transformers/event/json/ModEvents.java 0 → 100644
  1 +package com.mumfrey.liteloader.transformers.event.json;
  2 +
  3 +import java.io.File;
  4 +import java.util.HashMap;
  5 +import java.util.Map;
  6 +
  7 +import com.google.common.base.Charsets;
  8 +import com.mumfrey.liteloader.api.EnumerationObserver;
  9 +import com.mumfrey.liteloader.core.ModInfo;
  10 +import com.mumfrey.liteloader.core.api.LoadableModFile;
  11 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  12 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
  13 +import com.mumfrey.liteloader.interfaces.TweakContainer;
  14 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator.DisabledReason;
  15 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  16 +
  17 +public class ModEvents implements EnumerationObserver
  18 +{
  19 + private static final String DEFINITION_FILENAME = "events.json";
  20 +
  21 + private static Map<String, String> events = new HashMap<String, String>();
  22 +
  23 + @Override
  24 + public void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container)
  25 + {
  26 + if (container instanceof LoadableModFile)
  27 + {
  28 + LoadableModFile file = (LoadableModFile)container;
  29 + if (!file.exists()) return;
  30 +
  31 + String json = file.getFileContents(ModEvents.DEFINITION_FILENAME, Charsets.UTF_8);
  32 + if (json == null) return;
  33 +
  34 + LiteLoaderLogger.info("Registering %s for mod with id %s", ModEvents.DEFINITION_FILENAME, file.getIdentifier());
  35 + ModEvents.events.put(file.getIdentifier(), json);
  36 + }
  37 + }
  38 +
  39 + @Override
  40 + public void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason)
  41 + {
  42 + }
  43 +
  44 + @Override
  45 + public void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container)
  46 + {
  47 + }
  48 +
  49 + @Override
  50 + public void onModAdded(LoaderEnumerator enumerator, ModInfo<LoadableMod<?>> mod)
  51 + {
  52 + }
  53 +
  54 + static Map<String, String> getEvents()
  55 + {
  56 + return events;
  57 + }
  58 +}
... ...
java/common/com/mumfrey/liteloader/util/render/IconTextured.java
1 1 package com.mumfrey.liteloader.util.render;
2 2  
3   -import net.minecraft.util.IIcon;
  3 +import com.mumfrey.liteloader.client.util.render.Icon;
4 4 import net.minecraft.util.ResourceLocation;
5 5  
6 6 /**
... ... @@ -8,7 +8,7 @@ import net.minecraft.util.ResourceLocation;
8 8 *
9 9 * @author Adam Mummery-Smith
10 10 */
11   -public interface IconTextured extends IIcon
  11 +public interface IconTextured extends Icon
12 12 {
13 13 /**
14 14 * Get tooltip text, return null for no tooltip
... ...
java/common/net/eq2online/permissions/ReplicatedPermissionsContainer.java
... ... @@ -5,6 +5,8 @@ import java.util.Collection;
5 5 import java.util.Set;
6 6 import java.util.TreeSet;
7 7  
  8 +import net.minecraft.network.PacketBuffer;
  9 +
8 10 /**
9 11 * Serializable container object
10 12 *
... ... @@ -94,11 +96,11 @@ public class ReplicatedPermissionsContainer implements Serializable
94 96 * @param data Byte array containing the serialised data
95 97 * @return new container or null if deserialisation failed
96 98 */
97   - public static ReplicatedPermissionsContainer fromBytes(byte[] data)
  99 + public static ReplicatedPermissionsContainer fromPacketBuffer(PacketBuffer data)
98 100 {
99 101 try
100 102 {
101   - ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(data));
  103 + ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(data.readByteArray()));
102 104 ReplicatedPermissionsContainer object = (ReplicatedPermissionsContainer)inputStream.readObject();
103 105 return object;
104 106 }
... ...