diff --git a/dependencies.gradle b/dependencies.gradle index c7174cd58..63ef6c40d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -34,10 +34,11 @@ * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph */ dependencies { - api('com.github.GTNewHorizons:NotEnoughItems:2.7.8-GTNH:dev') - api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-516-GTNH:dev') + api('com.github.GTNewHorizons:NotEnoughItems:2.7.13-GTNH:dev') + api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-518-GTNH:dev') api('curse.maven:cofh-core-69162:2388751') api('com.github.GTNewHorizons:waila:1.8.2:dev') + api("com.github.GTNewHorizons:GTNHLib:0.6.0:dev") implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") { exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial' @@ -46,18 +47,18 @@ dependencies { compileOnly("com.github.GTNewHorizons:GTNHLib:0.6.0:dev") { transitive = false } compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev') compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false } - compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.0:dev') - compileOnly('com.github.GTNewHorizons:EnderIO:2.9.1:dev') - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.40:dev') { + compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev') + compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev') + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.50:dev') { exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework' exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial' } compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false } - compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.1-GTNH:dev') { transitive = false } - compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.0-GTNH:dev') { transitive = false } - compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.11:dev") { transitive = false } + compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.2-GTNH:dev') { transitive = false } + compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.2-GTNH:dev') { transitive = false } + compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.13:dev") { transitive = false } runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev") runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.6.0:dev") diff --git a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java index 74e9dbea5..cda5fd110 100644 --- a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java +++ b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java @@ -2,6 +2,8 @@ import net.minecraft.launchwrapper.IClassTransformer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; @@ -13,12 +15,15 @@ import com.glodblock.github.coremod.transform.ExternalStorageRegistryTransformer; import com.glodblock.github.coremod.transform.GuiCraftingTransformer; import com.glodblock.github.coremod.transform.NEITransformer; +import com.gtnewhorizon.gtnhlib.asm.ASMUtil; public class FCClassTransformer implements IClassTransformer { + private static final Logger logger = LogManager.getLogger("ASM AE2FC"); + @Override - public byte[] transform(String name, String transformedName, byte[] code) { - Transform tform; + public byte[] transform(String name, String transformedName, byte[] basicClass) { + ClassMapper tform; switch (transformedName) { case "appeng.crafting.CraftingTreeNode" -> tform = CraftingTreeNodeTransformer.INSTANCE; case "appeng.me.cache.CraftingGridCache" -> tform = CraftingGridCacheTransformer.INSTANCE; @@ -28,22 +33,21 @@ public byte[] transform(String name, String transformedName, byte[] code) { case "appeng.integration.modules.NEI" -> tform = NEITransformer.INSTANCE; case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE; default -> { - return code; + return basicClass; } } - System.out.println("[AE2FC] Transforming class: " + transformedName); - return tform.transformClass(code); - } - - public interface Transform { - - byte[] transformClass(byte[] code); + logger.debug("Transforming class: " + transformedName); + final byte[] bytes = tform.transformClass(basicClass); + if (FluidCraftCore.DUMP_CLASSES()) { + ASMUtil.saveAsRawClassFile(basicClass, transformedName + "_PRE", this); + ASMUtil.saveAsRawClassFile(bytes, transformedName + "_POST", this); + } + return bytes; } - public abstract static class ClassMapper implements Transform { + public abstract static class ClassMapper { - @Override - public byte[] transformClass(byte[] code) { + public final byte[] transformClass(byte[] code) { ClassReader reader = new ClassReader(code); ClassWriter writer = new ClassWriter(reader, getWriteFlags()); reader.accept(getClassMapper(writer), ClassReader.EXPAND_FRAMES); diff --git a/src/main/java/com/glodblock/github/coremod/FluidCraftCore.java b/src/main/java/com/glodblock/github/coremod/FluidCraftCore.java index 28c0caa27..6f9b97a94 100644 --- a/src/main/java/com/glodblock/github/coremod/FluidCraftCore.java +++ b/src/main/java/com/glodblock/github/coremod/FluidCraftCore.java @@ -11,9 +11,12 @@ @IFMLLoadingPlugin.TransformerExclusions("com.glodblock.github.coremod") public class FluidCraftCore implements IFMLLoadingPlugin { + private static final boolean DUMP_CLASSES = Boolean.parseBoolean(System.getProperty("ae2fc.dumpClass", "false")); + private static boolean OBF_ENV; + @Override public String[] getASMTransformerClass() { - return new String[] { FluidCraftCore.class.getPackage().getName() + ".FCClassTransformer" }; + return new String[] { FCClassTransformer.class.getName() }; } @Nullable @@ -30,7 +33,7 @@ public String getSetupClass() { @Override public void injectData(Map data) { - // NO-OP + OBF_ENV = (boolean) data.get("runtimeDeobfuscationEnabled"); } @Nullable @@ -38,4 +41,8 @@ public void injectData(Map data) { public String getAccessTransformerClass() { return null; } + + public static boolean DUMP_CLASSES() { + return DUMP_CLASSES || !OBF_ENV; + } } diff --git a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java index f4500f459..fc3818cf8 100644 --- a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java +++ b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java @@ -366,7 +366,8 @@ private boolean isGTMachine(Object o) { private boolean isFluidConduitConnected(TileEntity te, ForgeDirection dir) { try { ILiquidConduit liquidConduit = (ILiquidConduit) eioTypeCheck.invoke(te, ILiquidConduit.class); - return liquidConduit.getConnectionMode(dir.getOpposite()) != ConnectionMode.DISABLED; + return liquidConduit != null + && liquidConduit.getConnectionMode(dir.getOpposite()) != ConnectionMode.DISABLED; } catch (IllegalAccessException | InvocationTargetException e) { return false; }