mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 09:34:42 +00:00
Merge remote-tracking branch 'asdflj/dev' into dev
This commit is contained in:
10 files changed
+120
-12
No files matched your search
+1
-1
@@ -644,7 +644,7 @@ boolean performBuildScriptUpdate(String projectDir) {
|
||||
}
|
||||
|
||||
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
||||
Map parameters = ["connectTimeout": 5000, "readTimeout": 5000]
|
||||
|
||||
String currentBuildScript = getFile("build.gradle").getText()
|
||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||
|
||||
@@ -49,6 +49,8 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
private GuiButton selectCPU;
|
||||
private int tooltip = -1;
|
||||
|
||||
private ItemStack hoveredStack;
|
||||
|
||||
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
super( new ContainerFluidCraftConfirm( inventoryPlayer, te ) );
|
||||
@@ -202,7 +204,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
final List<String> lineList = new LinkedList<String>();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
hoveredStack = null;
|
||||
final int offY = 23;
|
||||
|
||||
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
|
||||
@@ -324,6 +326,8 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
|
||||
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
|
||||
hoveredStack = is;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, is );
|
||||
@@ -550,5 +554,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
lineList.add(GuiText.HoldShiftForTooltip.getLocal());
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getHoveredStack() {
|
||||
return hoveredStack;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
|
||||
|
||||
public class FCClassTransformer implements IClassTransformer {
|
||||
|
||||
@@ -29,6 +33,9 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
case "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm":
|
||||
tform = GuiCraftingTransformer.INSTANCE;
|
||||
break;
|
||||
case "appeng.integration.modules.NEI":
|
||||
tform = NEITransfermer.INSTANCE;
|
||||
break;
|
||||
default:
|
||||
return code;
|
||||
}
|
||||
@@ -46,17 +53,18 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
|
||||
@Override
|
||||
public byte[] transformClass(byte[] code) {
|
||||
ClassNode classNode = new ClassNode();
|
||||
ClassReader reader = new ClassReader(code);
|
||||
reader.accept(classNode, 0);
|
||||
ClassWriter writer = new ClassWriter(reader, getWriteFlags());
|
||||
reader.accept(getClassMapper(writer), 0);
|
||||
classNode.accept(getClassMapper(writer,classNode));
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
protected int getWriteFlags() {
|
||||
return 0;
|
||||
return COMPUTE_FRAMES|COMPUTE_MAXS;
|
||||
}
|
||||
|
||||
protected abstract ClassVisitor getClassMapper(ClassVisitor downstream);
|
||||
|
||||
protected abstract ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode);
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,15 @@ import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.crafting.MECraftingInventory;
|
||||
import appeng.me.MachineSet;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
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.common.parts.PartFluidInterface;
|
||||
@@ -26,6 +29,7 @@ import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.SetBackedMachineSet;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -169,4 +173,22 @@ public class CoreModHooks {
|
||||
Ae2Reflect.markCPUDirty(instance);
|
||||
}
|
||||
|
||||
public ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
||||
if (gui instanceof GuiCraftConfirm){
|
||||
return ((GuiCraftConfirm)gui).getHoveredStack();
|
||||
} else if (gui instanceof GuiFluidCraftConfirm) {
|
||||
return ((GuiFluidCraftConfirm)gui).getHoveredStack();
|
||||
} else if (gui instanceof GuiCraftingCPU){
|
||||
return ((GuiCraftingCPU)gui).getHoveredStack();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean shouldShowTooltip(GuiContainer gui) {
|
||||
if (gui instanceof GuiCraftConfirm)
|
||||
return ((GuiCraftConfirm)gui).getHoveredStack() == null;
|
||||
if (gui instanceof GuiCraftingCPU)
|
||||
return ((GuiCraftingCPU)gui).getHoveredStack() == null;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.glodblock.github.coremod.FCClassTransformer;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class ContainerInterfaceTerminalTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
@@ -14,7 +15,7 @@ public class ContainerInterfaceTerminalTransformer extends FCClassTransformer.Cl
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
return new TransformContainerInterfaceTerminal(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
@@ -15,7 +16,7 @@ public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
return new TransformCraftingCPUCluster(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class CraftingTreeNodeTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
@@ -15,7 +16,7 @@ public class CraftingTreeNodeTransformer extends FCClassTransformer.ClassMapper
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
return new TransformCraftingTreeNode(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.glodblock.github.coremod.FCClassTransformer;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
@@ -14,7 +15,7 @@ public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
return new TransformDualityInterface(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.glodblock.github.coremod.FCClassTransformer;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class GuiCraftingTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
@@ -14,7 +15,7 @@ public class GuiCraftingTransformer extends FCClassTransformer.ClassMapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
return new TransformGuiCrafting(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
public class NEITransfermer extends FCClassTransformer.ClassMapper{
|
||||
|
||||
public static final NEITransfermer INSTANCE = new NEITransfermer();
|
||||
|
||||
private NEITransfermer(){}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream, ClassNode classNode) {
|
||||
for (MethodNode method : classNode.methods){
|
||||
if(method.name.equals("getStackUnderMouse") || method.name.equals("shouldShowTooltip")){
|
||||
AbstractInsnNode targetNode = null;
|
||||
for (AbstractInsnNode instruction : method.instructions.toArray())
|
||||
{
|
||||
if (instruction.getOpcode() == ALOAD)
|
||||
{
|
||||
targetNode = instruction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
InsnList toInsert = new InsnList();
|
||||
toInsert.add(new VarInsnNode(ALOAD, 1));
|
||||
toInsert.add(new TypeInsnNode(INSTANCEOF, "com/glodblock/github/client/gui/GuiFluidCraftConfirm"));
|
||||
LabelNode label0 = new LabelNode();
|
||||
toInsert.add(new JumpInsnNode(IFEQ, label0));
|
||||
toInsert.add(new VarInsnNode(ALOAD, 1));
|
||||
toInsert.add(new TypeInsnNode(CHECKCAST, "com/glodblock/github/client/gui/GuiFluidCraftConfirm"));
|
||||
toInsert.add(new MethodInsnNode(INVOKEVIRTUAL, "com/glodblock/github/client/gui/GuiFluidCraftConfirm", "getHoveredStack", "()Lnet/minecraft/item/ItemStack;", false));
|
||||
if(method.name.equals("getStackUnderMouse")){
|
||||
toInsert.add(new InsnNode(ARETURN));
|
||||
}else{
|
||||
LabelNode label1 = new LabelNode();
|
||||
toInsert.add(new JumpInsnNode(IFNONNULL, label1));
|
||||
toInsert.add(new InsnNode(ICONST_1));
|
||||
LabelNode label2 = new LabelNode();
|
||||
toInsert.add(new JumpInsnNode(GOTO, label2));
|
||||
toInsert.add(label1);
|
||||
toInsert.add(new InsnNode(ICONST_0));
|
||||
toInsert.add(label2);
|
||||
toInsert.add(new InsnNode(IRETURN));
|
||||
}
|
||||
toInsert.add(label0);
|
||||
method.instructions.insertBefore(targetNode,toInsert);
|
||||
}
|
||||
}
|
||||
return new NEITransfermer.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 super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user