Skip to content

Commit

Permalink
Merge branch 'master' into fix-essentia-level-maintaining
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Jan 4, 2025
2 parents 0f9796b + d8de0e8 commit 5907154
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
17 changes: 9 additions & 8 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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")
Expand Down
30 changes: 17 additions & 13 deletions src/main/java/com/glodblock/github/coremod/FCClassTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/glodblock/github/coremod/FluidCraftCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,12 +33,16 @@ public String getSetupClass() {

@Override
public void injectData(Map<String, Object> data) {
// NO-OP
OBF_ENV = (boolean) data.get("runtimeDeobfuscationEnabled");
}

@Nullable
@Override
public String getAccessTransformerClass() {
return null;
}

public static boolean DUMP_CLASSES() {
return DUMP_CLASSES || !OBF_ENV;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5907154

Please sign in to comment.