mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
compatibility with ae native fluid
This commit is contained in:
1 parent
ddd046fa15
commit
bc1f6adf9d
6 files changed
+1
-461
No files matched your search
@@ -8,8 +8,6 @@ import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
|
||||
import com.glodblock.github.coremod.transform.CraftingCpuTransformer;
|
||||
import com.glodblock.github.coremod.transform.CraftingGridCacheTransformer;
|
||||
import com.glodblock.github.coremod.transform.CraftingTreeNodeTransformer;
|
||||
import com.glodblock.github.coremod.transform.DualityInterfaceTransformer;
|
||||
import com.glodblock.github.coremod.transform.ExternalStorageRegistryTransformer;
|
||||
@@ -25,9 +23,8 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
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;
|
||||
case "appeng.me.cluster.implementations.CraftingCPUCluster" -> tform = CraftingCpuTransformer.INSTANCE;
|
||||
case "appeng.helpers.DualityInterface" -> tform = DualityInterfaceTransformer.INSTANCE;
|
||||
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;
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.glodblock.github.coremod.hooker;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -15,55 +11,14 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.CraftingGridCacheFluidInventoryProxyCell;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryCrafting;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.IGuiTooltipHandler;
|
||||
import appeng.crafting.MECraftingInventory;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
public class CoreModHooks {
|
||||
|
||||
public static InventoryCrafting wrapCraftingBuffer(InventoryCrafting inv) {
|
||||
return new FluidConvertingInventoryCrafting(
|
||||
inv.eventHandler,
|
||||
inv.inventoryWidth,
|
||||
inv.getSizeInventory() / inv.inventoryWidth);
|
||||
}
|
||||
|
||||
public static IAEItemStack wrapFluidPacketStack(IAEItemStack stack) {
|
||||
if (stack.getItem() == ItemAndBlockHolder.PACKET) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack.getItemStack()));
|
||||
if (dropStack != null) {
|
||||
return dropStack;
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack removeFluidPackets(InventoryCrafting inv, int index) {
|
||||
ItemStack stack = inv.getStackInSlot(index);
|
||||
if (stack != null && stack.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
return ItemFluidDrop.newStack(fluid);
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static InventoryAdaptor wrapInventory(@Nullable TileEntity tile, ForgeDirection face) {
|
||||
return tile != null ? FluidConvertingInventoryAdaptor.wrap(tile, face) : null;
|
||||
@@ -88,61 +43,6 @@ public class CoreModHooks {
|
||||
} else return aeStack.getItemStack();
|
||||
}
|
||||
|
||||
public static long getFluidSize(IAEItemStack aeStack) {
|
||||
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
|
||||
return (long) Math.max(aeStack.getStackSize() / 1000D, 1);
|
||||
} else return aeStack.getStackSize();
|
||||
}
|
||||
|
||||
public static List<IMEInventoryHandler<?>> craftingGridCacheGetCellArray(final CraftingGridCache instance,
|
||||
final StorageChannel channel) {
|
||||
// Equivalent to original function, but using the proxy for fluid channel
|
||||
return channel == StorageChannel.ITEMS ? Arrays.asList(instance)
|
||||
: Arrays.asList(new CraftingGridCacheFluidInventoryProxyCell(instance));
|
||||
}
|
||||
|
||||
public static void storeFluidItem(CraftingCPUCluster instance) {
|
||||
final IGrid g = Ae2Reflect.getGrid(instance);
|
||||
|
||||
if (g == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IStorageGrid sg = g.getCache(IStorageGrid.class);
|
||||
final IMEInventory<IAEItemStack> ii = sg.getItemInventory();
|
||||
final IMEInventory<IAEFluidStack> jj = sg.getFluidInventory();
|
||||
final MECraftingInventory inventory = Ae2Reflect.getCPUInventory(instance);
|
||||
|
||||
for (IAEItemStack is : inventory.getItemList()) {
|
||||
is = inventory.extractItems(is.copy(), Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
|
||||
if (is != null) {
|
||||
Ae2Reflect.postCPUChange(instance, is, Ae2Reflect.getCPUSource(instance));
|
||||
if (is.getItem() instanceof ItemFluidDrop) {
|
||||
IAEFluidStack fluidDrop = ItemFluidDrop.getAeFluidStack(is);
|
||||
fluidDrop = jj.injectItems(fluidDrop, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
if (fluidDrop == null) {
|
||||
is = null;
|
||||
} else {
|
||||
is.setStackSize(fluidDrop.getStackSize());
|
||||
}
|
||||
} else {
|
||||
is = ii.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
}
|
||||
}
|
||||
|
||||
if (is != null) {
|
||||
inventory.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
}
|
||||
}
|
||||
|
||||
if (inventory.getItemList().isEmpty()) {
|
||||
Ae2Reflect.setCPUInventory(instance, new MECraftingInventory());
|
||||
}
|
||||
|
||||
Ae2Reflect.markCPUDirty(instance);
|
||||
}
|
||||
|
||||
public static ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
||||
if (gui instanceof IGuiTooltipHandler guiTooltipHandler) {
|
||||
return guiTooltipHandler.getHoveredStack();
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final CraftingCpuTransformer INSTANCE = new CraftingCpuTransformer();
|
||||
|
||||
private CraftingCpuTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new TransformCraftingCPUCluster(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformCraftingCPUCluster extends ClassVisitor {
|
||||
|
||||
TransformCraftingCPUCluster(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("executeCrafting")) {
|
||||
return new TransformExecuteCrafting(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
} else if (name.equals("cancel")) {
|
||||
return new TransformStoreItems(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformExecuteCrafting extends MethodVisitor {
|
||||
|
||||
private boolean gotInventory = false;
|
||||
private int reach_stack = 0;
|
||||
|
||||
TransformExecuteCrafting(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
|
||||
if (opcode == Opcodes.GETFIELD && owner.equals("appeng/me/cluster/implementations/CraftingCPUCluster")
|
||||
&& name.equals("inventory")) {
|
||||
gotInventory = true;
|
||||
}
|
||||
super.visitFieldInsn(opcode, owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLineNumber(int line, Label start) {
|
||||
gotInventory = false;
|
||||
super.visitLineNumber(line, start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJumpInsn(int opcode, Label label) {
|
||||
if (opcode == Opcodes.IFNULL && reach_stack == 0) {
|
||||
reach_stack = 1;
|
||||
}
|
||||
super.visitJumpInsn(opcode, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (reach_stack == 1) {
|
||||
if (opcode == Opcodes.INVOKEINTERFACE && owner.equals("appeng/api/storage/data/IAEItemStack")
|
||||
&& name.equals("getStackSize")) {
|
||||
reach_stack = 2;
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"getFluidSize",
|
||||
"(Lappeng/api/storage/data/IAEItemStack;)J",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (opcode == Opcodes.INVOKEVIRTUAL && owner.equals("net/minecraft/inventory/InventoryCrafting")
|
||||
&& (name.equals("getStackInSlot") || name.equals("func_70301_a"))) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"removeFluidPackets",
|
||||
"(Lnet/minecraft/inventory/InventoryCrafting;I)Lnet/minecraft/item/ItemStack;",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
if (gotInventory) {
|
||||
if (opcode == Opcodes.INVOKESTATIC && owner.equals("appeng/util/item/AEItemStack")
|
||||
&& name.equals("create")) {
|
||||
gotInventory = false;
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"wrapFluidPacketStack",
|
||||
"(Lappeng/api/storage/data/IAEItemStack;)Lappeng/api/storage/data/IAEItemStack;",
|
||||
false);
|
||||
}
|
||||
} else if (opcode == Opcodes.INVOKESPECIAL && owner.equals("net/minecraft/inventory/InventoryCrafting")
|
||||
&& name.equals("<init>")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"wrapCraftingBuffer",
|
||||
"(Lnet/minecraft/inventory/InventoryCrafting;)Lnet/minecraft/inventory/InventoryCrafting;",
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformStoreItems extends MethodVisitor {
|
||||
|
||||
TransformStoreItems(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (opcode == Opcodes.INVOKESPECIAL && owner.equals("appeng/me/cluster/implementations/CraftingCPUCluster")
|
||||
&& name.equals("storeItems")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"storeFluidItem",
|
||||
"(Lappeng/me/cluster/implementations/CraftingCPUCluster;)V",
|
||||
false);
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
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 CraftingGridCacheTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final CraftingGridCacheTransformer INSTANCE = new CraftingGridCacheTransformer();
|
||||
|
||||
private CraftingGridCacheTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new CraftingGridCacheTransformer.TransformCraftingGridCache(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformCraftingGridCache extends ClassVisitor {
|
||||
|
||||
TransformCraftingGridCache(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("getCellArray")) {
|
||||
return new CraftingGridCacheTransformer.ReplaceGetCellArray(
|
||||
api,
|
||||
super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReplaceGetCellArray extends MethodVisitor {
|
||||
|
||||
private final MethodVisitor target;
|
||||
|
||||
ReplaceGetCellArray(int api, MethodVisitor mv) {
|
||||
// Original method is replaced
|
||||
super(api, null);
|
||||
target = mv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCode() {
|
||||
target.visitCode();
|
||||
// Equivalent to
|
||||
// return CoreModHooks::craftingGridCacheGetCellArray(this, channel);
|
||||
target.visitVarInsn(Opcodes.ALOAD, 0);
|
||||
target.visitVarInsn(Opcodes.ALOAD, 1);
|
||||
target.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"craftingGridCacheGetCellArray",
|
||||
"(Lappeng/me/cache/CraftingGridCache;Lappeng/api/storage/StorageChannel;)Ljava/util/List;",
|
||||
false);
|
||||
target.visitInsn(Opcodes.ARETURN);
|
||||
target.visitMaxs(2, 3);
|
||||
target.visitEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
|
||||
public class CraftingGridCacheFluidInventoryProxyCell implements IMEInventoryHandler<IAEFluidStack> {
|
||||
|
||||
private final CraftingGridCache inner;
|
||||
|
||||
public CraftingGridCacheFluidInventoryProxyCell(final CraftingGridCache craftingGridCache) {
|
||||
inner = craftingGridCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
|
||||
return ItemFluidDrop
|
||||
.getAeFluidStack((IAEItemStack) inner.injectItems(ItemFluidDrop.newAeStack(input), type, src));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack getAvailableItem(@NotNull IAEFluidStack request, int iteration) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getAccess() {
|
||||
return inner.getAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(IAEFluidStack input) {
|
||||
return inner.isPrioritized(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEFluidStack input) {
|
||||
return inner.canAccept(ItemFluidDrop.newAeStack(input));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return inner.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot() {
|
||||
return inner.getSlot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass(int i) {
|
||||
return inner.validForPass(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoCraftingInventory() {
|
||||
return inner.isAutoCraftingInventory();
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,11 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.container.implementations.CraftingCPURecord;
|
||||
import appeng.crafting.MECraftingInventory;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
@@ -32,19 +27,12 @@ public class Ae2Reflect {
|
||||
private static final Field fInventory_containerUpgrade;
|
||||
private static final Field fAEPass_internal;
|
||||
private static final Field fAEInv_partitionList;
|
||||
private static final Field fCPU_cpu;
|
||||
private static final Field fCPU_myName;
|
||||
private static final Field fCPU_processors;
|
||||
private static final Field fCPU_size;
|
||||
private static final Field fCPU_inventory;
|
||||
private static final Field fCPU_machineSrc;
|
||||
private static final Field fContainerUpgradeable_upgradeable;
|
||||
private static final Field fDualInterface_gridProxy;
|
||||
private static final Field fCraftConfirm_result;
|
||||
private static final Method mItemSlot_setExtractable;
|
||||
private static final Method mCPU_getGrid;
|
||||
private static final Method mCPU_postChange;
|
||||
private static final Method mCPU_markDirty;
|
||||
private static final Method mP2PLiquids_getTarget;
|
||||
private static final Method mCraftConfirm_getGrid;
|
||||
|
||||
@@ -53,22 +41,11 @@ public class Ae2Reflect {
|
||||
fInventory_containerUpgrade = reflectField(ContainerUpgradeable.class, "upgradeable");
|
||||
fAEPass_internal = reflectField(MEPassThrough.class, "internal");
|
||||
fAEInv_partitionList = reflectField(MEInventoryHandler.class, "myPartitionList");
|
||||
fCPU_cpu = Ae2Reflect.reflectField(CraftingCPURecord.class, "cpu");
|
||||
fCPU_myName = Ae2Reflect.reflectField(CraftingCPURecord.class, "myName");
|
||||
fCPU_processors = Ae2Reflect.reflectField(CraftingCPURecord.class, "processors");
|
||||
fCPU_size = Ae2Reflect.reflectField(CraftingCPURecord.class, "size");
|
||||
fCPU_inventory = Ae2Reflect.reflectField(CraftingCPUCluster.class, "inventory");
|
||||
fCPU_machineSrc = Ae2Reflect.reflectField(CraftingCPUCluster.class, "machineSrc");
|
||||
fContainerUpgradeable_upgradeable = Ae2Reflect.reflectField(ContainerUpgradeable.class, "upgradeable");
|
||||
mItemSlot_setExtractable = reflectMethod(ItemSlot.class, "setExtractable", boolean.class);
|
||||
fDualInterface_gridProxy = reflectField(DualityInterface.class, "gridProxy");
|
||||
mCPU_getGrid = reflectMethod(CraftingCPUCluster.class, "getGrid");
|
||||
mCPU_postChange = reflectMethod(
|
||||
CraftingCPUCluster.class,
|
||||
"postChange",
|
||||
IAEItemStack.class,
|
||||
BaseActionSource.class);
|
||||
mCPU_markDirty = reflectMethod(CraftingCPUCluster.class, "markDirty");
|
||||
mP2PLiquids_getTarget = reflectMethod(PartP2PLiquids.class, "getTarget");
|
||||
fCraftConfirm_result = reflectField(ContainerCraftConfirm.class, "result");
|
||||
mCraftConfirm_getGrid = reflectMethod(ContainerCraftConfirm.class, "getGrid");
|
||||
@@ -132,22 +109,10 @@ public class Ae2Reflect {
|
||||
}
|
||||
}
|
||||
|
||||
public static ICraftingCPU getCPU(CraftingCPURecord cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_cpu);
|
||||
}
|
||||
|
||||
public static String getName(CraftingCPURecord cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_myName);
|
||||
}
|
||||
|
||||
public static int getProcessors(CraftingCPURecord cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_processors);
|
||||
}
|
||||
|
||||
public static long getSize(CraftingCPURecord cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_size);
|
||||
}
|
||||
|
||||
public static IUpgradeableHost getUpgradeList(ContainerUpgradeable container) {
|
||||
return Ae2Reflect.readField(container, fInventory_containerUpgrade);
|
||||
}
|
||||
@@ -172,18 +137,6 @@ public class Ae2Reflect {
|
||||
return Ae2Reflect.readField(ccc, fCraftConfirm_result);
|
||||
}
|
||||
|
||||
public static MECraftingInventory getCPUInventory(CraftingCPUCluster cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_inventory);
|
||||
}
|
||||
|
||||
public static void setCPUInventory(CraftingCPUCluster cpu, MECraftingInventory value) {
|
||||
Ae2Reflect.writeField(cpu, fCPU_inventory, value);
|
||||
}
|
||||
|
||||
public static MachineSource getCPUSource(CraftingCPUCluster cpu) {
|
||||
return Ae2Reflect.readField(cpu, fCPU_machineSrc);
|
||||
}
|
||||
|
||||
public static IUpgradeableHost getUpgradeableHost(ContainerUpgradeable owner) {
|
||||
return Ae2Reflect.readField(owner, fContainerUpgradeable_upgradeable);
|
||||
}
|
||||
@@ -192,22 +145,6 @@ public class Ae2Reflect {
|
||||
return Ae2Reflect.readField(owner, fDualInterface_gridProxy);
|
||||
}
|
||||
|
||||
public static void postCPUChange(CraftingCPUCluster cpu, IAEItemStack stack, MachineSource src) {
|
||||
try {
|
||||
mCPU_postChange.invoke(cpu, stack, src);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to invoke method: " + mCPU_postChange, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void markCPUDirty(CraftingCPUCluster cpu) {
|
||||
try {
|
||||
mCPU_markDirty.invoke(cpu);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to invoke method: " + mCPU_markDirty, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static IFluidHandler getP2PLiquidTarget(PartP2PLiquids p2p) {
|
||||
try {
|
||||
return (IFluidHandler) mP2PLiquids_getTarget.invoke(p2p);
|
||||
|
||||
Reference in new issue
Block a user