Compare commits

..
Author SHA1 Message Date
Yoshy 16d18145b5 Fix some typos (#397) 2026-01-28 06:15:45 -05:00
Kogepan229 a93ddd5191 Fix stock replenisher item voiding (#396) 2026-01-18 10:28:52 +01:00
lc-1337 f3c3a81681 Use bigger inventory (#395) 2026-01-17 09:35:58 +01:00
lc-1337 1ea9b2e410 Fix replenisher void (#394) 2026-01-16 18:34:26 +01:00
Kogepan229 cf189f00a3 Revert part of "remove transformers (#389)" (#393) 2026-01-16 17:13:56 +01:00
UltraProdigy a121342a4b Change Artificial Universe Fluid Cell to 63 Types (#392) 2026-01-16 13:41:36 +01:00
lc-1337 e62215f02b remove transformers (#389) 2026-01-15 08:06:47 +01:00
danyadevandgithub-actions[bot] f4c6d8a3f0 fix NPE when trying to drain a tank in a tank tower (#390)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-13 11:54:36 -05:00
12 changed files with 348 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.8.48-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-775-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-790-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.9.15:dev')
api("com.github.GTNewHorizons:GTNHLib:0.8.41:dev")
@@ -70,6 +70,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
return mainTank.drain(fluid, amount, doDrain, false);
}
if (this.getFluid() == null) {
return null;
}
FluidStack drainedFluid = this.tank.drain(amount, doDrain);
int drained = drainedFluid != null ? drainedFluid.amount : 0;
@@ -80,10 +84,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
if (drained < amount) {
TileCertusQuartzTank tankBelow = this.getTankBelow();
if (tankBelow != null) {
FluidStack externallyDrained = tankBelow.drain(fluid, amount - drained, doDrain, false);
FluidStack externallyDrained = tankBelow.drain(this.getFluid(), amount - drained, doDrain, false);
if (externallyDrained != null) {
return new FluidStack(fluid, drained + externallyDrained.amount);
return new FluidStack(this.getFluid(), drained + externallyDrained.amount);
}
}
}
@@ -49,6 +49,7 @@ import appeng.tile.events.TileEventType;
import appeng.tile.grid.AENetworkInvTile;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.BiggerAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.item.AEFluidStack;
import appeng.util.item.AEItemStack;
@@ -58,7 +59,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
implements IAEFluidInventory, IFluidHandler, IPowerChannelState, IGridTickable, ITerminalHost {
private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 63);
private final BiggerAppEngInventory invItems = new BiggerAppEngInventory(this, 63);
private final AEFluidInventory invFluids = new AEFluidInventory(this, 9, Integer.MAX_VALUE);
private final AppEngInternalAEInventory configFluids = new AppEngInternalAEInventory(this, 9);
private final AppEngInternalAEInventory configItems = new AppEngInternalAEInventory(this, 63);
@@ -69,6 +70,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
private long storedItemCount;
public TileSuperStockReplenisher() {
super(false);
getProxy().setIdlePowerUsage(4D);
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.source = new MachineSource(this);
@@ -171,6 +173,8 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
if (tempStack != null) {
tempStack.stackSize = tempStack.stackSize + (int) notInserted.getStackSize();
storedItemCount += notInserted.getStackSize();
saveChanges();
} else invItems.setInventorySlotContents(index, notInserted.getItemStack());
}
} catch (final GridAccessException ignored) {}
@@ -188,6 +192,8 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
if (tempStack != null) {
tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize();
storedItemCount += extracted.getStackSize();
saveChanges();
} else invItems.setInventorySlotContents(index, extracted.getItemStack());
}
} catch (final GridAccessException ignored) {}
@@ -295,8 +301,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
} catch (GridAccessException e) {
AELog.error(e, "Couldn't wake up level emitter for delayed updates");
}
markForUpdate();
}
public void fullRefund() {
@@ -365,7 +369,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
@Override
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
saveChanges();
markForUpdate();
}
@Override
@@ -0,0 +1,55 @@
package com.glodblock.github.coremod;
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;
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[] basicClass) {
ClassMapper tform;
switch (transformedName) {
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm", "appeng.client.gui.widgets.GuiCraftingTree" -> tform = GuiCraftingTransformer.INSTANCE;
case "appeng.integration.modules.NEI" -> tform = NEITransformer.INSTANCE;
case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE;
default -> {
return basicClass;
}
}
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 {
public final byte[] transformClass(byte[] code) {
ClassReader reader = new ClassReader(code);
ClassWriter writer = new ClassWriter(reader, getWriteFlags());
reader.accept(getClassMapper(writer), ClassReader.EXPAND_FRAMES);
return writer.toByteArray();
}
protected int getWriteFlags() {
return 0;
}
protected abstract ClassVisitor getClassMapper(ClassVisitor downstream);
}
}
@@ -11,9 +11,12 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
@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 null;
return new String[] { FCClassTransformer.class.getName() };
}
@Nullable
@@ -29,11 +32,17 @@ public class FluidCraftCore implements IFMLLoadingPlugin {
}
@Override
public void injectData(Map<String, Object> data) {}
public void injectData(Map<String, Object> data) {
OBF_ENV = (boolean) data.get("runtimeDeobfuscationEnabled");
}
@Nullable
@Override
public String getAccessTransformerClass() {
return null;
}
public static boolean DUMP_CLASSES() {
return DUMP_CLASSES || !OBF_ENV;
}
}
@@ -0,0 +1,28 @@
package com.glodblock.github.coremod.hooker;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.IGuiTooltipHandler;
public class CoreModHooks {
public static ItemStack displayFluid(IAEItemStack aeStack) {
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(aeStack.getItemStack());
return ItemFluidPacket.newDisplayStack(fluid);
} else return aeStack.getItemStack();
}
public static ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
if (gui instanceof IGuiTooltipHandler guiTooltipHandler) {
return guiTooltipHandler.getHoveredStack();
}
return null;
}
}
@@ -0,0 +1,9 @@
package com.glodblock.github.coremod.hooker;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CoreModHooksClient {
}
@@ -0,0 +1,104 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import com.glodblock.github.coremod.FCClassTransformer;
public class ExternalStorageRegistryTransformer extends FCClassTransformer.ClassMapper {
public static final ExternalStorageRegistryTransformer INSTANCE = new ExternalStorageRegistryTransformer();
private ExternalStorageRegistryTransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new TransformExternalStorageRegistry(Opcodes.ASM5, downstream);
}
@Override
protected int getWriteFlags() {
return ClassWriter.COMPUTE_FRAMES;
}
private static class TransformExternalStorageRegistry extends ClassVisitor {
public TransformExternalStorageRegistry(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if ("getHandler".equals(name)) {
return new TransformGetHandler(api, super.visitMethod(access, name, desc, signature, exceptions));
} else {
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
private static class TransformGetHandler extends MethodVisitor {
private int cnt_return = 0;
private int cnt_if = 0;
private Label L6 = null;
private final Label L9 = new Label();
TransformGetHandler(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitJumpInsn(int opcode, Label label) {
if (opcode == Opcodes.IFEQ) {
cnt_if++;
}
if (cnt_if == 3) {
L6 = label;
cnt_if++;
super.visitJumpInsn(opcode, L9);
return;
}
super.visitJumpInsn(opcode, label);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.ARETURN) {
cnt_return++;
}
super.visitInsn(opcode);
if (cnt_return == 2) {
super.visitLabel(L9);
super.visitFieldInsn(
Opcodes.GETSTATIC,
"com/glodblock/github/inventory/external/AEFluidTankHandler",
"INSTANCE",
"Lcom/glodblock/github/inventory/external/AEFluidTankHandler;");
super.visitVarInsn(Opcodes.ALOAD, 1);
super.visitVarInsn(Opcodes.ALOAD, 2);
super.visitVarInsn(Opcodes.ALOAD, 3);
super.visitVarInsn(Opcodes.ALOAD, 4);
super.visitMethodInsn(
Opcodes.INVOKEVIRTUAL,
"com/glodblock/github/inventory/external/AEFluidTankHandler",
"canHandle",
"(Lnet/minecraft/tileentity/TileEntity;Lnet/minecraftforge/common/util/ForgeDirection;Lappeng/api/storage/StorageChannel;Lappeng/api/networking/security/BaseActionSource;)Z",
false);
super.visitJumpInsn(Opcodes.IFEQ, L6);
super.visitFieldInsn(
Opcodes.GETSTATIC,
"com/glodblock/github/inventory/external/AEFluidTankHandler",
"INSTANCE",
"Lcom/glodblock/github/inventory/external/AEFluidTankHandler;");
super.visitInsn(Opcodes.ARETURN);
cnt_return++;
}
}
}
}
@@ -0,0 +1,58 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import com.glodblock.github.coremod.FCClassTransformer;
public class GuiCraftingTransformer extends FCClassTransformer.ClassMapper {
public static final GuiCraftingTransformer INSTANCE = new GuiCraftingTransformer();
private GuiCraftingTransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new TransformGuiCrafting(Opcodes.ASM5, downstream);
}
private static class TransformGuiCrafting extends ClassVisitor {
TransformGuiCrafting(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if ("drawFG".equals(name) || "drawListFG".equals(name) || "drawStack".equals(name)) {
return new TransformFluidIcon(api, super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class TransformFluidIcon extends MethodVisitor {
TransformFluidIcon(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (opcode == Opcodes.INVOKEINTERFACE && owner.equals("appeng/api/storage/data/IAEItemStack")
&& name.equals("getItemStack")) {
super.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"displayFluid",
"(Lappeng/api/storage/data/IAEItemStack;)Lnet/minecraft/item/ItemStack;",
false);
} else {
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
}
}
@@ -0,0 +1,62 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import com.glodblock.github.coremod.FCClassTransformer;
public class NEITransformer extends FCClassTransformer.ClassMapper {
public static final NEITransformer INSTANCE = new NEITransformer();
private NEITransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new TransformNEI(Opcodes.ASM5, downstream);
}
private static class TransformNEI extends ClassVisitor {
TransformNEI(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return switch (name) {
case "getStackUnderMouse" -> new TransformStackUnderMouse(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default -> super.visitMethod(access, name, desc, signature, exceptions);
};
}
}
private static class TransformStackUnderMouse extends MethodVisitor {
TransformStackUnderMouse(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.ACONST_NULL) {
super.visitVarInsn(Opcodes.ALOAD, 1);
super.visitVarInsn(Opcodes.ILOAD, 2);
super.visitVarInsn(Opcodes.ILOAD, 3);
super.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"getStackUnderMouse",
"(Lnet/minecraft/client/gui/inventory/GuiContainer;II)Lnet/minecraft/item/ItemStack;",
false);
return;
}
super.visitInsn(opcode);
}
}
}
@@ -137,7 +137,7 @@ public class ItemAndBlockHolder {
NameConst.ITEM_ARTIFICIAL_UNIVERSE_STORAGE,
Long.MAX_VALUE / 2048,
16384,
5,
63,
600000D).register();
public static ItemFluidVoidStorageCell FLUID_VOID_CELL = new ItemFluidVoidStorageCell().register();
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().register();
@@ -83,10 +83,10 @@ ae2fc.waila.disable=Disable
ae2fc.tooltip.shift_for_more=§r> Hold §3Shift§r for more information
ae2fc.tooltip.ctrl_for_more=§r> Hold §3Ctrl§r for more information
ae2fc.tooltip.fluid_packet_decoder.desc=The Fluid Decoder can decode Fluid packets. It has to be connected to a ME System and a place to store the liquid in otherwise it won't work.
ae2fc.tooltip.fluid_packet_decoder.desc=The Fluid Decoder can decode Fluid packets. It has to be connected to a ME System and a place to store the liquid in, otherwise it won't work.
ae2fc.tooltip.fluid_buffer.desc=This is a high speed fluid IO
ae2fc.tooltip.walrus.desc=GTNH is like a job
ae2fc.tooltip.fluid_auto_filler=Creates fluid canning pattern with given container automatically.
ae2fc.tooltip.fluid_auto_filler=Creates a fluid canning pattern with the given container automatically.
ae2fc.tooltip.level_maintainer.Who_Am_I=Who Am I?
ae2fc.tooltip.level_maintainer.title=§6Request Status§r
ae2fc.tooltip.level_maintainer.desc=Automatically keeps items and fluids in stock by requesting new crafts when needed. Has to be connected to an ME network.
@@ -116,15 +116,15 @@ ae2fc.tooltip.ultra_terminal.WIRELESS_ESSENTIA_TERMINAL=Mode: Essentia Terminal
ae2fc.tooltip.ultra_terminal.WIRELESS_INTERFACE_TERMINAL=Mode: Interface Terminal
ae2fc.tooltip.ultra_terminal.WIRELESS_FLUID_PATTERN_TERMINAL_EX=Mode: Processing Pattern Terminal
ae2fc.tooltip.ultra_terminal=Right click + sneaking to switch mode.
ae2fc.tooltip.ultra_terminal.tips=ToolTips:
ae2fc.tooltip.ultra_terminal.tips.desc=1.You can put it to baubles slot and use hotkey to open.\n2.Interface mode hold §3Shift§7 toggle interface renamer button.\n3.When you are in the crafting plan screen.\nHold §3Shift§7 click cancel button will automatically add missing items to NEI bookmark.
ae2fc.tooltip.ultra_terminal.tips=Tooltips:
ae2fc.tooltip.ultra_terminal.tips.desc=1. You can put it to baubles slot and use hotkey to open.\n2. Interface mode hold §3Shift§7 toggle interface renamer button.\n3. When you are in the crafting plan screen.\nHold §3Shift§7 click cancel button will automatically add missing items to NEI bookmark.
ae2fc.tooltip.ultra_terminal.restock.on=Restock activated
ae2fc.tooltip.ultra_terminal.restock.off=Restock deactivated
ae2fc.tooltip.infinity_fluid=§aInfinity§r
ae2fc.tooltip.fluid_storage.void=Where nothing is everything, and everything is nothing
ae2fc.tooltip.quantum_bridge_card.desc=Allows wireless terminals to connect to a quantum bridge, allowing for unlimited range
ae2fc.tooltip.energy_card.desc=Infinity Energy for the Wireless Terminal
ae2fc.tooltip.energy_card.desc=Infinite Energy for the Wireless Terminal
ae2fc.tooltip.cell_contents=Contains Fluid:
ae2fc.tooltip.cell_empty=Cell is empty
@@ -208,7 +208,7 @@ ae2fc.gui.magnet.nbt=Ignore NBT Data
ae2fc.gui.magnet.meta=Ignore Meta Data
ae2fc.gui.magnet.ore=Use Ore Dictionary
ae2fc.gui.magnet.whitelist=Whitelisting
ae2fc.gui.magnet.blacklist=BlackListing
ae2fc.gui.magnet.blacklist=Blacklisting
ae2fc.gui.color.StateNone=00000000
ae2fc.gui.color.StateIdle=FF55FF55