Commit 10400e12bd4cb12e59e3361cb43e748c0307261a

Authored by Mumfrey
1 parent 7e6adb61

LiteLoader 1.5_01

+ Compatibility for FML's new runtime deobfuscation
java/com/mumfrey/liteloader/core/LiteLoader.java
@@ -65,7 +65,7 @@ public final class LiteLoader implements FilenameFilter @@ -65,7 +65,7 @@ public final class LiteLoader implements FilenameFilter
65 /** 65 /**
66 * Liteloader version 66 * Liteloader version
67 */ 67 */
68 - private static final String LOADER_VERSION = "1.5"; 68 + private static final String LOADER_VERSION = "1.5_01";
69 69
70 /** 70 /**
71 * Loader revision, can be used by mods to determine whether the loader is sufficiently up-to-date 71 * Loader revision, can be used by mods to determine whether the loader is sufficiently up-to-date
@@ -336,7 +336,7 @@ public final class LiteLoader implements FilenameFilter @@ -336,7 +336,7 @@ public final class LiteLoader implements FilenameFilter
336 */ 336 */
337 private void prepareClassOverrides() 337 private void prepareClassOverrides()
338 { 338 {
339 - this.registerBaseClassOverride(ModUtilities.getObfuscatedFieldName("net.minecraft.src.CallableJVMFlags", "h"), "h"); 339 + this.registerBaseClassOverride(ModUtilities.getObfuscatedFieldName("net.minecraft.src.CallableJVMFlags", "h", "h"), "h");
340 } 340 }
341 341
342 /** 342 /**
java/com/mumfrey/liteloader/util/ModUtilities.java
@@ -8,14 +8,29 @@ import java.util.Set; @@ -8,14 +8,29 @@ import java.util.Set;
8 8
9 import com.mumfrey.liteloader.core.LiteLoader; 9 import com.mumfrey.liteloader.core.LiteLoader;
10 10
  11 +import net.minecraft.client.ClientBrandRetriever;
11 import net.minecraft.client.Minecraft; 12 import net.minecraft.client.Minecraft;
12 import net.minecraft.src.*; 13 import net.minecraft.src.*;
13 14
14 public abstract class ModUtilities 15 public abstract class ModUtilities
15 { 16 {
  17 + /**
  18 + * Collection of packets we have already overridden, so that duplicate registrations can generate a warning
  19 + */
16 private static Set<Integer> overriddenPackets = new HashSet<Integer>(); 20 private static Set<Integer> overriddenPackets = new HashSet<Integer>();
17 21
18 /** 22 /**
  23 + * True if FML is being used, in which case we use searge names instead of raw field/method names
  24 + */
  25 + private static boolean forgeModLoader = false;
  26 +
  27 + static
  28 + {
  29 + // Check for FML
  30 + forgeModLoader = ClientBrandRetriever.getClientModName().contains("fml");
  31 + }
  32 +
  33 + /**
19 * Add a renderer map entry for the specified entity class 34 * Add a renderer map entry for the specified entity class
20 * 35 *
21 * @param entityClass 36 * @param entityClass
@@ -92,9 +107,10 @@ public abstract class ModUtilities @@ -92,9 +107,10 @@ public abstract class ModUtilities
92 * @param fieldName Name of field to get, returned unmodified if in debug mode 107 * @param fieldName Name of field to get, returned unmodified if in debug mode
93 * @return Obfuscated field name if present 108 * @return Obfuscated field name if present
94 */ 109 */
95 - public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName) 110 + public static String getObfuscatedFieldName(String fieldName, String obfuscatedFieldName, String seargeFieldName)
96 { 111 {
97 - return (!net.minecraft.src.Tessellator.instance.getClass().getSimpleName().equals("Tessellator")) ? obfuscatedFieldName : fieldName; 112 + if (forgeModLoader) return seargeFieldName;
  113 + return !net.minecraft.src.Tessellator.instance.getClass().getSimpleName().equals("Tessellator") ? obfuscatedFieldName : fieldName;
98 } 114 }
99 115
100 /** 116 /**
java/com/mumfrey/liteloader/util/PrivateFields.java
@@ -33,6 +33,8 @@ public class PrivateFields&lt;P, T&gt; @@ -33,6 +33,8 @@ public class PrivateFields&lt;P, T&gt;
33 */ 33 */
34 public final String name; 34 public final String name;
35 35
  36 + public final String seargeName;
  37 +
36 /** 38 /**
37 * Name used to access the field, determined at init 39 * Name used to access the field, determined at init
38 */ 40 */
@@ -45,13 +47,14 @@ public class PrivateFields&lt;P, T&gt; @@ -45,13 +47,14 @@ public class PrivateFields&lt;P, T&gt;
45 * @param mcpName 47 * @param mcpName
46 * @param name 48 * @param name
47 */ 49 */
48 - private PrivateFields(Class<P> owner, String mcpName, String name) 50 + private PrivateFields(Class<P> owner, String mcpName, String name, String seargeName)
49 { 51 {
50 this.parentClass = owner; 52 this.parentClass = owner;
51 - this.mcpName = mcpName;  
52 - this.name = name; 53 + this.mcpName = mcpName;
  54 + this.name = name;
  55 + this.seargeName = seargeName;
53 56
54 - this.fieldName = ModUtilities.getObfuscatedFieldName(mcpName, name); 57 + this.fieldName = ModUtilities.getObfuscatedFieldName(mcpName, name, seargeName);
55 } 58 }
56 59
57 /** 60 /**
@@ -127,16 +130,16 @@ public class PrivateFields&lt;P, T&gt; @@ -127,16 +130,16 @@ public class PrivateFields&lt;P, T&gt;
127 */ 130 */
128 public static final class StaticFields<P, T> extends PrivateFields<P, T> 131 public static final class StaticFields<P, T> extends PrivateFields<P, T>
129 { 132 {
130 - public StaticFields(Class<P> owner, String mcpName, String name) { super(owner, mcpName, name); } 133 + public StaticFields(Class<P> owner, String mcpName, String name, String fmlName) { super(owner, mcpName, name, fmlName); }
131 public T get() { return get(null); } 134 public T get() { return get(null); }
132 public void set(T value) { set(null, value); } 135 public void set(T value) { set(null, value); }
133 136
134 - public static final StaticFields<Packet, Map> packetClassToIdMap = new StaticFields<Packet, Map> (Packet.class, "packetClassToIdMap", "a"); // Packet/packetClassToIdMap  
135 - public static final StaticFields<TileEntity, Map> tileEntityNameToClassMap = new StaticFields<TileEntity, Map> (TileEntity.class, "nameToClassMap", "a"); // TileEntity/nameToClassMap 137 + public static final StaticFields<Packet, Map> packetClassToIdMap = new StaticFields<Packet, Map> (Packet.class, "packetClassToIdMap", "a", "field_73291_a"); // Packet/packetClassToIdMap
  138 + public static final StaticFields<TileEntity, Map> tileEntityNameToClassMap = new StaticFields<TileEntity, Map> (TileEntity.class, "nameToClassMap", "a", "field_70326_a"); // TileEntity/nameToClassMap
136 } 139 }
137 140
138 - public static final PrivateFields<Minecraft, Timer> minecraftTimer = new PrivateFields<Minecraft, Timer> (Minecraft.class, "timer", "V"); // Minecraft/timer  
139 - public static final PrivateFields<Minecraft, Profiler> minecraftProfiler = new PrivateFields<Minecraft, Profiler> (Minecraft.class, "mcProfiler", "J"); // Minecraft/mcProfiler  
140 - public static final PrivateFields<RenderManager, Map> entityRenderMap = new PrivateFields<RenderManager, Map> (RenderManager.class, "entityRenderMap", "q"); // RenderManager/entityRenderMap 141 + public static final PrivateFields<Minecraft, Timer> minecraftTimer = new PrivateFields<Minecraft, Timer> (Minecraft.class, "timer", "V", "field_71428_T"); // Minecraft/timer
  142 + public static final PrivateFields<Minecraft, Profiler> minecraftProfiler = new PrivateFields<Minecraft, Profiler> (Minecraft.class, "mcProfiler", "J", "field_71424_I"); // Minecraft/mcProfiler
  143 + public static final PrivateFields<RenderManager, Map> entityRenderMap = new PrivateFields<RenderManager, Map> (RenderManager.class, "entityRenderMap", "q", "field_78729_o"); // RenderManager/entityRenderMap
141 } 144 }
142 145