diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-18 17:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 18:03:23 +0200 |
| commit | fbdbb388c369fae549cfde3eed38b536f7461d90 (patch) | |
| tree | b46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/preloader/asm/transformers | |
| parent | b670446fdf49991093b485f0aa14050039632775 (diff) | |
| download | GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2 GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip | |
Cleaning up (#767)
* Kill playerAPI
* Gut more events and compat that is now obsolete
* Remove commented out code
* Remove final modifier from methods
* Make more stuff final
* Remove slow building ring
* Protected -> private in final classes
* More cleaning
* More cleaning v2
* Purging
* Clean DevHelper
* Clean DevHelper 2
* delete DevHelper
* remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files
* check for obfuscation only once in the IFMLloadingPlugin.injectData
* don't instantiate the static class ASMConfig
* delete unused and empty implementation of IFMLCallHook
* delete empty class
* delete ClassesToTransform class that just holds the class names constants
* delete unused methods and unsless logging in dummymod container
* delete unused transformer ClassTransformer_TT_ThaumicRestorer
* spotless
* Clean
* Clean utils
* Build checkpoint
* Purge
* Stage 2
* Stage 3
* Stage 4
* Stage 5
* Stage 6
* Spotless
* Imports
* Stage idk
* Stage 1
* Fix issue
* Spotless
* Format numbers
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/preloader/asm/transformers')
7 files changed, 1160 insertions, 1907 deletions
diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_COFH_OreDictionaryArbiter.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_COFH_OreDictionaryArbiter.java index 29998800a0..84fecda974 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_COFH_OreDictionaryArbiter.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_COFH_OreDictionaryArbiter.java @@ -29,7 +29,6 @@ import cpw.mods.fml.relauncher.FMLRelaunchLog; import gnu.trove.map.TMap; import gnu.trove.map.hash.THashMap; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.DevHelper; public class ClassTransformer_COFH_OreDictionaryArbiter { @@ -75,14 +74,7 @@ public class ClassTransformer_COFH_OreDictionaryArbiter { public void injectMethod(String aMethodName) { - boolean isObfuscated; - try { - isObfuscated = Class.forName("net.minecraft.item.ItemStack") != null ? false : true; - } catch (ClassNotFoundException e) { - isObfuscated = true; - } - String aItemStack = isObfuscated ? DevHelper.getObfuscated("net/minecraft/item/ItemStack") - : "net/minecraft/item/ItemStack"; + String aItemStack = "net/minecraft/item/ItemStack"; MethodVisitor mv; if (aMethodName.equals("registerOreDictionaryEntry")) { FMLRelaunchLog.log( @@ -158,9 +150,9 @@ public class ClassTransformer_COFH_OreDictionaryArbiter { .getField(OreDictionaryArbiter.class, "stackNames").get(null); } catch (Throwable t) { oreIDs = HashBiMap.create(); - oreStacks = new THashMap<Integer, ArrayList<ItemStack>>(); - stackIDs = new THashMap<ItemWrapper, ArrayList<Integer>>(); - stackNames = new THashMap<ItemWrapper, ArrayList<String>>(); + oreStacks = new THashMap<>(); + stackIDs = new THashMap<>(); + stackNames = new THashMap<>(); } } @@ -173,13 +165,13 @@ public class ClassTransformer_COFH_OreDictionaryArbiter { int arg1 = OreDictionary.getOreID(arg0); oreIDs.put(arg0, Integer.valueOf(arg1)); if (!oreStacks.containsKey(Integer.valueOf(arg1))) { - oreStacks.put(Integer.valueOf(arg1), new ArrayList<ItemStack>()); + oreStacks.put(Integer.valueOf(arg1), new ArrayList<>()); } ((ArrayList<ItemStack>) oreStacks.get(Integer.valueOf(arg1))).add(arg); ItemWrapper arg2 = ItemWrapper.fromItemStack(arg); if (!stackIDs.containsKey(arg2)) { - stackIDs.put(arg2, new ArrayList<Integer>()); - stackNames.put(arg2, new ArrayList<String>()); + stackIDs.put(arg2, new ArrayList<>()); + stackNames.put(arg2, new ArrayList<>()); } ((ArrayList<Integer>) stackIDs.get(arg2)).add(Integer.valueOf(arg1)); ((ArrayList<String>) stackNames.get(arg2)).add(arg0); diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_ChunkLoading.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_ChunkLoading.java index cda4384f7d..9b6ec4bb25 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_ChunkLoading.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_ChunkLoading.java @@ -50,7 +50,6 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.preloader.DevHelper; public class ClassTransformer_Forge_ChunkLoading { @@ -71,8 +70,8 @@ public class ClassTransformer_Forge_ChunkLoading { public ClassTransformer_Forge_ChunkLoading(byte[] basicClass, boolean obfuscated) { - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; + ClassReader aTempReader; + ClassWriter aTempWriter; aTempReader = new ClassReader(basicClass); aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); @@ -88,11 +87,9 @@ public class ClassTransformer_Forge_ChunkLoading { if (reader != null && writer != null && !doesMethodAlreadyExist) { - aChunkCoordIntPair = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/ChunkCoordIntPair") - : "net/minecraft/world/ChunkCoordIntPair"; - aWorld = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/World") : "net/minecraft/world/World"; - aEntity = obfuscated ? DevHelper.getObfuscated("net/minecraft/entity/Entity") - : "net/minecraft/entity/Entity"; + aChunkCoordIntPair = "net/minecraft/world/ChunkCoordIntPair"; + aWorld = "net/minecraft/world/World"; + aEntity = "net/minecraft/entity/Entity"; injectMethod("forceChunk"); injectMethod("unforceChunk"); @@ -101,14 +98,6 @@ public class ClassTransformer_Forge_ChunkLoading { } } - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - public ClassWriter getWriter() { return writer; } @@ -119,993 +108,1115 @@ public class ClassTransformer_Forge_ChunkLoading { "[GT++ ASM] Chunkloading Patch", Level.INFO, "Injecting " + aMethodName + " into " + className + "."); - if (aMethodName.equals("forceChunk")) { + switch (aMethodName) { + case "forceChunk" -> { - mv = getWriter().visitMethod( - ACC_PUBLIC + ACC_STATIC, - "forceChunk", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(730, l0); - mv.visitVarInsn(ALOAD, 0); - Label l1 = new Label(); - mv.visitJumpInsn(IFNULL, l1); - mv.visitVarInsn(ALOAD, 1); - Label l2 = new Label(); - mv.visitJumpInsn(IFNONNULL, l2); - mv.visitLabel(l1); - mv.visitLineNumber(732, l1); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(RETURN); - mv.visitLabel(l2); - mv.visitLineNumber(734, l2); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$500", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Lnet/minecraftforge/common/ForgeChunkManager$Type;", - false); - mv.visitFieldInsn( - GETSTATIC, - "net/minecraftforge/common/ForgeChunkManager$Type", - "ENTITY", - "Lnet/minecraftforge/common/ForgeChunkManager$Type;"); - Label l3 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l3); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$600", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)L" + aEntity + ";", - false); - mv.visitJumpInsn(IFNONNULL, l3); - Label l4 = new Label(); - mv.visitLabel(l4); - mv.visitLineNumber(736, l4); - mv.visitTypeInsn(NEW, "java/lang/RuntimeException"); - mv.visitInsn(DUP); - mv.visitLdcInsn("Attempted to use an entity ticket to force a chunk, without an entity"); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false); - mv.visitInsn(ATHROW); - mv.visitLabel(l3); - mv.visitLineNumber(738, l3); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "isPlayerTicket", - "()Z", - false); - Label l5 = new Label(); - mv.visitJumpInsn(IFEQ, l5); - mv.visitFieldInsn( - GETSTATIC, - "net/minecraftforge/common/ForgeChunkManager", - "playerTickets", - "Lcom/google/common/collect/SetMultimap;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKEINTERFACE, - "com/google/common/collect/SetMultimap", - "containsValue", - "(Ljava/lang/Object;)Z", - true); - Label l6 = new Label(); - mv.visitJumpInsn(IFNE, l6); - Label l7 = new Label(); - mv.visitJumpInsn(GOTO, l7); - mv.visitLabel(l5); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitFieldInsn(GETSTATIC, "net/minecraftforge/common/ForgeChunkManager", "tickets", "Ljava/util/Map;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "world", - "L" + aWorld + ";"); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", true); - mv.visitTypeInsn(CHECKCAST, "com/google/common/collect/Multimap"); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$200", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/lang/String;", - false); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKEINTERFACE, - "com/google/common/collect/Multimap", - "containsEntry", - "(Ljava/lang/Object;Ljava/lang/Object;)Z", - true); - mv.visitJumpInsn(IFNE, l6); - mv.visitLabel(l7); - mv.visitLineNumber(740, l7); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitLdcInsn( - "The mod %s attempted to force load a chunk with an invalid ticket. This is not permitted."); - mv.visitInsn(ICONST_1); - mv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); - mv.visitInsn(DUP); - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$200", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/lang/String;", - false); - mv.visitInsn(AASTORE); - mv.visitMethodInsn( - INVOKESTATIC, - "cpw/mods/fml/common/FMLLog", - "severe", - "(Ljava/lang/String;[Ljava/lang/Object;)V", - false); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(741, l8); - mv.visitInsn(RETURN); - mv.visitLabel(l6); - mv.visitLineNumber(743, l6); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$700", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/util/LinkedHashSet;", - false); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/LinkedHashSet", "add", "(Ljava/lang/Object;)Z", false); - mv.visitInsn(POP); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(744, l9); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/ChunkDebugger", - "storeLoadChunkToCache", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", - false); - Label l10 = new Label(); - mv.visitLabel(l10); - mv.visitLineNumber(745, l10); - mv.visitFieldInsn( - GETSTATIC, - "net/minecraftforge/common/MinecraftForge", - "EVENT_BUS", - "Lcpw/mods/fml/common/eventhandler/EventBus;"); - mv.visitTypeInsn(NEW, "net/minecraftforge/common/ForgeChunkManager$ForceChunkEvent"); - mv.visitInsn(DUP); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKESPECIAL, - "net/minecraftforge/common/ForgeChunkManager$ForceChunkEvent", - "<init>", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", - false); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "cpw/mods/fml/common/eventhandler/EventBus", - "post", - "(Lcpw/mods/fml/common/eventhandler/Event;)Z", - false); - mv.visitInsn(POP); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(747, l11); - mv.visitMethodInsn( - INVOKESTATIC, - "com/google/common/collect/ImmutableSetMultimap", - "builder", - "()Lcom/google/common/collect/ImmutableSetMultimap$Builder;", - false); - mv.visitFieldInsn( - GETSTATIC, - "net/minecraftforge/common/ForgeChunkManager", - "forcedChunks", - "Ljava/util/Map;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "world", - "L" + aWorld + ";"); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", true); - mv.visitTypeInsn(CHECKCAST, "com/google/common/collect/Multimap"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "com/google/common/collect/ImmutableSetMultimap$Builder", - "putAll", - "(Lcom/google/common/collect/Multimap;)Lcom/google/common/collect/ImmutableSetMultimap$Builder;", - false); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "com/google/common/collect/ImmutableSetMultimap$Builder", - "put", - "(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSetMultimap$Builder;", - false); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "com/google/common/collect/ImmutableSetMultimap$Builder", - "build", - "()Lcom/google/common/collect/ImmutableSetMultimap;", - false); - mv.visitVarInsn(ASTORE, 2); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitLineNumber(748, l12); - mv.visitFieldInsn( - GETSTATIC, - "net/minecraftforge/common/ForgeChunkManager", - "forcedChunks", - "Ljava/util/Map;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "world", - "L" + aWorld + ";"); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn( - INVOKEINTERFACE, - "java/util/Map", - "put", - "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", - true); - mv.visitInsn(POP); - Label l13 = new Label(); - mv.visitLabel(l13); - mv.visitLineNumber(749, l13); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$800", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)I", - false); - Label l14 = new Label(); - mv.visitJumpInsn(IFLE, l14); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$700", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/util/LinkedHashSet;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/LinkedHashSet", "size", "()I", false); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$800", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)I", - false); - mv.visitJumpInsn(IF_ICMPLE, l14); - Label l15 = new Label(); - mv.visitLabel(l15); - mv.visitLineNumber(751, l15); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager$Ticket", - "access$700", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/util/LinkedHashSet;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/LinkedHashSet", "iterator", "()Ljava/util/Iterator;", false); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); - mv.visitTypeInsn(CHECKCAST, "" + aChunkCoordIntPair + ""); - mv.visitVarInsn(ASTORE, 3); - Label l16 = new Label(); - mv.visitLabel(l16); - mv.visitLineNumber(752, l16); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, - "net/minecraftforge/common/ForgeChunkManager", - "unforceChunk", - "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", - false); - mv.visitLabel(l14); - mv.visitLineNumber(754, l14); - mv.visitFrame(F_APPEND, 1, new Object[] { "com/google/common/collect/ImmutableSetMultimap" }, 0, null); - mv.visitInsn(RETURN); - Label l17 = new Label(); - mv.visitLabel(l17); - mv.visitLocalVariable("ticket", "Lnet/minecraftforge/common/ForgeChunkManager$Ticket;", null, l0, l17, 0); - mv.visitLocalVariable("chunk", "L" + aChunkCoordIntPair + ";", null, l0, l17, 1); - mv.visitLocalVariable( - "newMap", - "Lcom/google/common/collect/ImmutableSetMultimap;", - "Lcom/google/common/collect/ImmutableSetMultimap<L" + aChunkCoordIntPair - + ";Lnet/minecraftforge/common/ForgeChunkManager$Ticket;>;", - l12, - l17, - 2); - mv.visitLocalVariable("removed", "L" + aChunkCoordIntPair + ";", null, l16, l14, 3); - mv.visitMaxs(5, 4); - mv.visitEnd(); + mv = getWriter().visitMethod( + ACC_PUBLIC + ACC_STATIC, + "forceChunk", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", + null, + null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(730, l0); + mv.visitVarInsn(ALOAD, 0); + Label l1 = new Label(); + mv.visitJumpInsn(IFNULL, l1); + mv.visitVarInsn(ALOAD, 1); + Label l2 = new Label(); + mv.visitJumpInsn(IFNONNULL, l2); + mv.visitLabel(l1); + mv.visitLineNumber(732, l1); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitInsn(RETURN); + mv.visitLabel(l2); + mv.visitLineNumber(734, l2); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$500", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Lnet/minecraftforge/common/ForgeChunkManager$Type;", + false); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/ForgeChunkManager$Type", + "ENTITY", + "Lnet/minecraftforge/common/ForgeChunkManager$Type;"); + Label l3 = new Label(); + mv.visitJumpInsn(IF_ACMPNE, l3); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$600", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)L" + aEntity + ";", + false); + mv.visitJumpInsn(IFNONNULL, l3); + Label l4 = new Label(); + mv.visitLabel(l4); + mv.visitLineNumber(736, l4); + mv.visitTypeInsn(NEW, "java/lang/RuntimeException"); + mv.visitInsn(DUP); + mv.visitLdcInsn("Attempted to use an entity ticket to force a chunk, without an entity"); + mv.visitMethodInsn( + INVOKESPECIAL, + "java/lang/RuntimeException", + "<init>", + "(Ljava/lang/String;)V", + false); + mv.visitInsn(ATHROW); + mv.visitLabel(l3); + mv.visitLineNumber(738, l3); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKEVIRTUAL, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "isPlayerTicket", + "()Z", + false); + Label l5 = new Label(); + mv.visitJumpInsn(IFEQ, l5); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/ForgeChunkManager", + "playerTickets", + "Lcom/google/common/collect/SetMultimap;"); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKEINTERFACE, + "com/google/common/collect/SetMultimap", + "containsValue", + "(Ljava/lang/Object;)Z", + true); + Label l6 = new Label(); + mv.visitJumpInsn(IFNE, l6); + Label l7 = new Label(); + mv.visitJumpInsn(GOTO, l7); + mv.visitLabel(l5); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/ForgeChunkManager", + "tickets", + "Ljava/util/Map;"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn( + GETFIELD, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "world", + "L" + aWorld + ";"); + mv.visitMethodInsn( + INVOKEINTERFACE, + "java/util/Map", + "get", + "(Ljava/lang/Object;)Ljava/lang/Object;", + true); + mv.visitTypeInsn(CHECKCAST, "com/google/common/collect/Multimap"); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$200", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/lang/String;", + false); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKEINTERFACE, + "com/google/common/collect/Multimap", + "containsEntry", + "(Ljava/lang/Object;Ljava/lang/Object;)Z", + true); + mv.visitJumpInsn(IFNE, l6); + mv.visitLabel(l7); + mv.visitLineNumber(740, l7); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitLdcInsn( + "The mod %s attempted to force load a chunk with an invalid ticket. This is not permitted."); + mv.visitInsn(ICONST_1); + mv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); + mv.visitInsn(DUP); + mv.visitInsn(ICONST_0); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$200", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/lang/String;", + false); + mv.visitInsn(AASTORE); + mv.visitMethodInsn( + INVOKESTATIC, + "cpw/mods/fml/common/FMLLog", + "severe", + "(Ljava/lang/String;[Ljava/lang/Object;)V", + false); + Label l8 = new Label(); + mv.visitLabel(l8); + mv.visitLineNumber(741, l8); + mv.visitInsn(RETURN); + mv.visitLabel(l6); + mv.visitLineNumber(743, l6); + mv.visitFrame(F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$700", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/util/LinkedHashSet;", + false); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/LinkedHashSet", "add", "(Ljava/lang/Object;)Z", false); + mv.visitInsn(POP); + Label l9 = new Label(); + mv.visitLabel(l9); + mv.visitLineNumber(744, l9); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn( + INVOKESTATIC, + "gtPlusPlus/preloader/ChunkDebugger", + "storeLoadChunkToCache", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", + false); + Label l10 = new Label(); + mv.visitLabel(l10); + mv.visitLineNumber(745, l10); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/MinecraftForge", + "EVENT_BUS", + "Lcpw/mods/fml/common/eventhandler/EventBus;"); + mv.visitTypeInsn(NEW, "net/minecraftforge/common/ForgeChunkManager$ForceChunkEvent"); + mv.visitInsn(DUP); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn( + INVOKESPECIAL, + "net/minecraftforge/common/ForgeChunkManager$ForceChunkEvent", + "<init>", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;L" + aChunkCoordIntPair + ";)V", + false); + mv.visitMethodInsn( + INVOKEVIRTUAL, + "cpw/mods/fml/common/eventhandler/EventBus", + "post", + "(Lcpw/mods/fml/common/eventhandler/Event;)Z", + false); + mv.visitInsn(POP); + Label l11 = new Label(); + mv.visitLabel(l11); + mv.visitLineNumber(747, l11); + mv.visitMethodInsn( + INVOKESTATIC, + "com/google/common/collect/ImmutableSetMultimap", + "builder", + "()Lcom/google/common/collect/ImmutableSetMultimap$Builder;", + false); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/ForgeChunkManager", + "forcedChunks", + "Ljava/util/Map;"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn( + GETFIELD, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "world", + "L" + aWorld + ";"); + mv.visitMethodInsn( + INVOKEINTERFACE, + "java/util/Map", + "get", + "(Ljava/lang/Object;)Ljava/lang/Object;", + true); + mv.visitTypeInsn(CHECKCAST, "com/google/common/collect/Multimap"); + mv.visitMethodInsn( + INVOKEVIRTUAL, + "com/google/common/collect/ImmutableSetMultimap$Builder", + "putAll", + "(Lcom/google/common/collect/Multimap;)Lcom/google/common/collect/ImmutableSetMultimap$Builder;", + false); + mv.visitVarInsn(ALOAD, 1); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKEVIRTUAL, + "com/google/common/collect/ImmutableSetMultimap$Builder", + "put", + "(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSetMultimap$Builder;", + false); + mv.visitMethodInsn( + INVOKEVIRTUAL, + "com/google/common/collect/ImmutableSetMultimap$Builder", + "build", + "()Lcom/google/common/collect/ImmutableSetMultimap;", + false); + mv.visitVarInsn(ASTORE, 2); + Label l12 = new Label(); + mv.visitLabel(l12); + mv.visitLineNumber(748, l12); + mv.visitFieldInsn( + GETSTATIC, + "net/minecraftforge/common/ForgeChunkManager", + "forcedChunks", + "Ljava/util/Map;"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn( + GETFIELD, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "world", + "L" + aWorld + ";"); + mv.visitVarInsn(ALOAD, 2); + mv.visitMethodInsn( + INVOKEINTERFACE, + "java/util/Map", + "put", + "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", + true); + mv.visitInsn(POP); + Label l13 = new Label(); + mv.visitLabel(l13); + mv.visitLineNumber(749, l13); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$800", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)I", + false); + Label l14 = new Label(); + mv.visitJumpInsn(IFLE, l14); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$700", + "(Lnet/minecraftforge/common/ForgeChunkManager$Ticket;)Ljava/util/LinkedHashSet;", + false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/LinkedHashSet", "size", "()I", false); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn( + INVOKESTATIC, + "net/minecraftforge/common/ForgeChunkManager$Ticket", + "access$800", |
