From e268d96c886e9f9e3d2f1eecdc6097777f366e8b Mon Sep 17 00:00:00 2001 From: GlodBlock <1356392126@qq.com> Date: Sat, 1 Oct 2022 20:12:32 +0800 Subject: [PATCH] a bunch of stuff --- build.gradle | 16 +-- gradle.properties | 5 +- .../java/com/glodblock/github/FluidCraft.java | 2 +- .../GuiExtendedFluidPatternTerminal.java | 71 ++++++++++- .../client/GuiFluidPatternTerminal.java | 73 ++++++++++- .../github/client/GuiItemAmountChange.java | 117 ++++++++++++++++++ .../github/client/GuiItemDualInterface.java | 30 +++++ .../github/client/button/GuiFCImgButton.java | 14 ++- .../client/client/gui/GuiWrapInterface.java | 60 +++++++++ ...ContainerExtendedFluidPatternTerminal.java | 5 + .../ContainerFluidPatternTerminal.java | 3 + .../container/ContainerItemAmountChange.java | 57 +++++++++ .../container/ContainerItemDualInterface.java | 35 ++++++ .../container/ContainerWrapInterface.java | 35 ++++++ .../PartExtendedFluidPatternTerminal.java | 16 +++ .../common/part/PartFluidPatternTerminal.java | 16 +++ .../github/coremod/CoreModHooks.java | 33 ++++- .../github/coremod/FCClassTransformer.java | 7 ++ .../transform/CraftingCpuTransformer.java | 9 ++ .../DualityInterfaceTransformer.java | 42 ++++++- .../transform/GuiBridgeTransformer.java | 56 +++++++++ .../GuiContainerWrapperTransformer.java | 75 +++++++++++ ...dPatternTerminalRecipeTransferHandler.java | 2 +- ...idPatternEncoderRecipeTransferHandler.java | 80 ++++++------ ...dPatternTerminalRecipeTransferHandler.java | 2 +- .../BlockingFluidInventoryAdaptor.java | 3 + .../inventory/ExAppEngInternalInventory.java | 57 +++++++++ .../FluidConvertingInventoryAdaptor.java | 36 ++++-- .../glodblock/github/inventory/GuiType.java | 15 ++- .../github/loader/ChannelLoader.java | 2 + .../network/CPacketFluidPatternTermBtns.java | 22 ++++ .../network/CPacketInventoryAction.java | 98 +++++++++++++++ .../network/CPacketPatternValueSet.java | 87 +++++++++++++ .../glodblock/github/proxy/CommonProxy.java | 2 - .../com/glodblock/github/util/Ae2Reflect.java | 39 ++++++ .../github/util/Ae2ReflectClient.java | 50 ++++++++ .../com/glodblock/github/util/NameConst.java | 2 + .../resources/assets/ae2fc/lang/en_us.lang | 10 ++ .../ae2fc/models/item/fluid_packet.json | 3 +- .../assets/ae2fc/textures/gui/states.png | Bin 734 -> 1655 bytes .../ae2fc/textures/items/fluid_packet.png | Bin 825 -> 253 bytes .../textures/items/fluid_packet_overlay.png | Bin 618 -> 0 bytes 42 files changed, 1206 insertions(+), 81 deletions(-) create mode 100644 src/main/java/com/glodblock/github/client/GuiItemAmountChange.java create mode 100644 src/main/java/com/glodblock/github/client/client/gui/GuiWrapInterface.java create mode 100644 src/main/java/com/glodblock/github/client/container/ContainerItemAmountChange.java create mode 100644 src/main/java/com/glodblock/github/client/container/ContainerItemDualInterface.java create mode 100644 src/main/java/com/glodblock/github/client/container/ContainerWrapInterface.java create mode 100644 src/main/java/com/glodblock/github/coremod/transform/GuiBridgeTransformer.java create mode 100644 src/main/java/com/glodblock/github/coremod/transform/GuiContainerWrapperTransformer.java create mode 100644 src/main/java/com/glodblock/github/inventory/ExAppEngInternalInventory.java create mode 100644 src/main/java/com/glodblock/github/network/CPacketInventoryAction.java create mode 100644 src/main/java/com/glodblock/github/network/CPacketPatternValueSet.java delete mode 100644 src/main/resources/assets/ae2fc/textures/items/fluid_packet_overlay.png diff --git a/build.gradle b/build.gradle index 967c14bcd..6e18e6637 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'idea' -version = "2.3.4-r" +version = "2.4.0-r" group = "ae2fc" archivesBaseName = "Fluid Craft for AE2" @@ -42,17 +42,17 @@ repositories { maven { url 'https://dvs1.progwml6.com/files/maven/' } maven { url 'https://jitpack.io/' } maven { url 'https://cursemaven.com/' } - maven { url "https://minecraft.curseforge.com/api/maven/" } + maven { url 'https://minecraft.curseforge.com/api/maven/' } } dependencies { - compile 'com.github.phantamanta44:jsr305:1.0.1' deobfCompile 'mezz.jei:jei_1.12.2:4.15.0.293' //jei - deobfCompile "curse.maven:ae2-extended-life-570458:3785381" // pae2 - deobfCompile "curse.maven:packagedauto-308380:2977147" // 1.0.3.14 - deobfCompile "curse.maven:modular-machinery-270790:2761302" // 1.11.1 - deobfCompile "curse.maven:codechicken-lib-1-8-242818:2779848" //ccl - deobfCompile "curse.maven:gregtech-ce-unofficial-557242:3784798" // gt + deobfCompile 'curse.maven:ae2-extended-life-570458:3785381' // pae2 + deobfCompile 'curse.maven:packagedauto-308380:2977147' // 1.0.3.14 + deobfCompile 'curse.maven:modular-machinery-270790:2761302' // 1.11.1 + deobfCompile 'curse.maven:codechicken-lib-1-8-242818:2779848' //ccl + deobfCompile 'curse.maven:gregtech-ce-unofficial-557242:3784798' // gt + compileOnly "curse.maven:dynamistics-383632:3056455" // dy } minecraft { diff --git a/gradle.properties b/gradle.properties index 14c3bd4e6..8b1378917 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1 @@ -systemProp.http.proxyHost=127.0.0.1 -systemProp.http.proxyPort=7890 -systemProp.https.proxyHost=127.0.0.1 -systemProp.https.proxyPort=7890 + diff --git a/src/main/java/com/glodblock/github/FluidCraft.java b/src/main/java/com/glodblock/github/FluidCraft.java index acf529c0a..28581d4f4 100644 --- a/src/main/java/com/glodblock/github/FluidCraft.java +++ b/src/main/java/com/glodblock/github/FluidCraft.java @@ -20,7 +20,7 @@ public class FluidCraft { public static final String MODID = "ae2fc"; - public static final String VERSION = "2.3.4-r"; + public static final String VERSION = "2.4.0-r"; @Mod.Instance(MODID) public static FluidCraft INSTANCE; diff --git a/src/main/java/com/glodblock/github/client/GuiExtendedFluidPatternTerminal.java b/src/main/java/com/glodblock/github/client/GuiExtendedFluidPatternTerminal.java index 9267f5276..517c068ba 100644 --- a/src/main/java/com/glodblock/github/client/GuiExtendedFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/client/GuiExtendedFluidPatternTerminal.java @@ -1,21 +1,33 @@ package com.glodblock.github.client; import appeng.api.storage.ITerminalHost; +import appeng.api.storage.data.IAEItemStack; import appeng.client.gui.implementations.GuiExpandedProcessingPatternTerm; import appeng.client.gui.widgets.GuiTabButton; import appeng.client.render.StackSizeRenderer; +import appeng.container.AEBaseContainer; +import appeng.container.slot.OptionalSlotFake; import appeng.container.slot.SlotFake; +import appeng.container.slot.SlotFakeCraftingMatrix; +import appeng.util.item.AEItemStack; import com.glodblock.github.FluidCraft; import com.glodblock.github.client.button.GuiFCImgButton; import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal; import com.glodblock.github.client.render.FluidRenderUtils; +import com.glodblock.github.common.item.ItemFluidPacket; import com.glodblock.github.inventory.GuiType; import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.inventory.slot.SlotSingleItem; import com.glodblock.github.network.CPacketFluidPatternTermBtns; +import com.glodblock.github.network.CPacketInventoryAction; import com.glodblock.github.util.Ae2ReflectClient; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnull; public class GuiExtendedFluidPatternTerminal extends GuiExpandedProcessingPatternTerm { @@ -24,6 +36,8 @@ public class GuiExtendedFluidPatternTerminal extends GuiExpandedProcessingPatter private GuiTabButton craftingStatusBtn; private GuiFCImgButton combineEnableBtn; private GuiFCImgButton combineDisableBtn; + private GuiFCImgButton fluidEnableBtn; + private GuiFCImgButton fluidDisableBtn; public GuiExtendedFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) { super(inventoryPlayer, te); @@ -44,16 +58,35 @@ public void initGui() { this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 153, "NOT_COMBINE", "DONT_COMBINE" ); this.combineDisableBtn.setHalfSize( true ); this.buttonList.add( this.combineDisableBtn ); + + this.fluidEnableBtn = new GuiFCImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 143, "FLUID_FIRST", "FLUID" ); + this.fluidEnableBtn.setHalfSize( true ); + this.buttonList.add( this.fluidEnableBtn ); + + this.fluidDisableBtn = new GuiFCImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 143, "ORIGIN_ORDER", "ITEM" ); + this.fluidDisableBtn.setHalfSize( true ); + this.buttonList.add( this.fluidDisableBtn ); } @Override public void drawSlot(Slot slot) { - if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot( - slot, slot.getStack(), stackSizeRenderer, fontRenderer))) { + if (!(slot instanceof SlotFake && (FluidRenderUtils.renderFluidPacketIntoGuiSlot( + slot, slot.getStack(), stackSizeRenderer, fontRenderer) || renderMEStyleSlot(slot, slot.getStack())))) { super.drawSlot(slot); } } + private boolean renderMEStyleSlot(Slot slot, @Nonnull ItemStack stack) { + if (slot instanceof SlotFake && !stack.isEmpty() && !(stack.getItem() instanceof ItemFluidPacket)) { + super.drawSlot(new SlotSingleItem(slot)); + if (stack.getCount() > 1) { + this.stackSizeRenderer.renderStackSize(fontRenderer, AEItemStack.fromItemStack(stack), slot.xPos, slot.yPos); + } + return true; + } + return false; + } + @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { if ( this.container.combine ) @@ -66,6 +99,16 @@ public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { this.combineEnableBtn.visible = false; this.combineDisableBtn.visible = true; } + if (this.container.fluidFirst) + { + this.fluidEnableBtn.visible = true; + this.fluidDisableBtn.visible = false; + } + else + { + this.fluidEnableBtn.visible = false; + this.fluidDisableBtn.visible = true; + } super.drawFG(offsetX, offsetY, mouseX, mouseY); } @@ -75,9 +118,33 @@ protected void actionPerformed(final GuiButton btn) { InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS); } else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) { FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns( "PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0" )); + } else if (this.fluidDisableBtn == btn || this.fluidEnableBtn == btn) { + FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns( "PatternTerminal.Fluid", this.fluidDisableBtn == btn ? "1" : "0" )); } else { super.actionPerformed(btn); } } + @Override + protected void handleMouseClick(Slot slot, int slotIdx, int mouseButton, ClickType clickType) { + if (mouseButton == 2 ) { + if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) { + if (slot.getHasStack()) { + IAEItemStack stack = AEItemStack.fromItemStack(slot.getStack()); + ((AEBaseContainer) this.inventorySlots).setTargetStack(stack); + int x = 0; + for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i ++) { + if (this.inventorySlots.inventorySlots.get(i).equals(slot)) { + x = i; + break; + } + } + FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(1, x, 0, stack)); + return; + } + } + } + super.handleMouseClick(slot, slotIdx, mouseButton, clickType); + } + } diff --git a/src/main/java/com/glodblock/github/client/GuiFluidPatternTerminal.java b/src/main/java/com/glodblock/github/client/GuiFluidPatternTerminal.java index e60a190bd..777ff779f 100644 --- a/src/main/java/com/glodblock/github/client/GuiFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/client/GuiFluidPatternTerminal.java @@ -1,21 +1,33 @@ package com.glodblock.github.client; import appeng.api.storage.ITerminalHost; +import appeng.api.storage.data.IAEItemStack; import appeng.client.gui.implementations.GuiPatternTerm; import appeng.client.gui.widgets.GuiTabButton; import appeng.client.render.StackSizeRenderer; +import appeng.container.AEBaseContainer; +import appeng.container.slot.OptionalSlotFake; import appeng.container.slot.SlotFake; +import appeng.container.slot.SlotFakeCraftingMatrix; +import appeng.util.item.AEItemStack; import com.glodblock.github.FluidCraft; import com.glodblock.github.client.button.GuiFCImgButton; import com.glodblock.github.client.container.ContainerFluidPatternTerminal; import com.glodblock.github.client.render.FluidRenderUtils; +import com.glodblock.github.common.item.ItemFluidPacket; import com.glodblock.github.inventory.GuiType; import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.inventory.slot.SlotSingleItem; import com.glodblock.github.network.CPacketFluidPatternTermBtns; +import com.glodblock.github.network.CPacketInventoryAction; import com.glodblock.github.util.Ae2ReflectClient; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnull; public class GuiFluidPatternTerminal extends GuiPatternTerm { @@ -24,6 +36,8 @@ public class GuiFluidPatternTerminal extends GuiPatternTerm { private GuiTabButton craftingStatusBtn; private GuiFCImgButton combineEnableBtn; private GuiFCImgButton combineDisableBtn; + private GuiFCImgButton fluidEnableBtn; + private GuiFCImgButton fluidDisableBtn; public GuiFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) { super(inventoryPlayer, te); @@ -44,6 +58,14 @@ public void initGui() { this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, "NOT_COMBINE", "DONT_COMBINE" ); this.combineDisableBtn.setHalfSize( true ); this.buttonList.add( this.combineDisableBtn ); + + this.fluidEnableBtn = new GuiFCImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 153, "FLUID_FIRST", "FLUID" ); + this.fluidEnableBtn.setHalfSize( true ); + this.buttonList.add( this.fluidEnableBtn ); + + this.fluidDisableBtn = new GuiFCImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 153, "ORIGIN_ORDER", "ITEM" ); + this.fluidDisableBtn.setHalfSize( true ); + this.buttonList.add( this.fluidDisableBtn ); } @Override @@ -66,26 +88,71 @@ public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { this.combineEnableBtn.visible = false; this.combineDisableBtn.visible = false; } + if (this.container.fluidFirst) + { + this.fluidEnableBtn.visible = true; + this.fluidDisableBtn.visible = false; + } + else + { + this.fluidEnableBtn.visible = false; + this.fluidDisableBtn.visible = true; + } super.drawFG(offsetX, offsetY, mouseX, mouseY); } @Override public void drawSlot(Slot slot) { - if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot( - slot, slot.getStack(), stackSizeRenderer, fontRenderer))) { - super.drawSlot(slot); + if (!(slot instanceof SlotFake && (FluidRenderUtils.renderFluidPacketIntoGuiSlot( + slot, slot.getStack(), stackSizeRenderer, fontRenderer) || renderMEStyleSlot(slot, slot.getStack())))) { + super.drawSlot(slot); } } + private boolean renderMEStyleSlot(Slot slot, @Nonnull ItemStack stack) { + if (slot instanceof SlotFake && !stack.isEmpty() && !(stack.getItem() instanceof ItemFluidPacket)) { + super.drawSlot(new SlotSingleItem(slot)); + if (stack.getCount() > 1) { + this.stackSizeRenderer.renderStackSize(fontRenderer, AEItemStack.fromItemStack(stack), slot.xPos, slot.yPos); + } + return true; + } + return false; + } + @Override protected void actionPerformed(final GuiButton btn) { if (btn == craftingStatusBtn) { InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS); } else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) { FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns( "PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0" )); + } else if (this.fluidDisableBtn == btn || this.fluidEnableBtn == btn) { + FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns( "PatternTerminal.Fluid", this.fluidDisableBtn == btn ? "1" : "0" )); } else { super.actionPerformed(btn); } } + @Override + protected void handleMouseClick(Slot slot, int slotIdx, int mouseButton, ClickType clickType) { + if (mouseButton == 2 ) { + if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) { + if (slot.getHasStack()) { + IAEItemStack stack = AEItemStack.fromItemStack(slot.getStack()); + ((AEBaseContainer) this.inventorySlots).setTargetStack(stack); + int x = 0; + for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i ++) { + if (this.inventorySlots.inventorySlots.get(i).equals(slot)) { + x = i; + break; + } + } + FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(1, x, 0, stack)); + return; + } + } + } + super.handleMouseClick(slot, slotIdx, mouseButton, clickType); + } + } \ No newline at end of file diff --git a/src/main/java/com/glodblock/github/client/GuiItemAmountChange.java b/src/main/java/com/glodblock/github/client/GuiItemAmountChange.java new file mode 100644 index 000000000..9d858da2c --- /dev/null +++ b/src/main/java/com/glodblock/github/client/GuiItemAmountChange.java @@ -0,0 +1,117 @@ +package com.glodblock.github.client; + +import appeng.api.storage.ITerminalHost; +import appeng.client.gui.implementations.GuiCraftAmount; +import appeng.client.gui.widgets.GuiNumberBox; +import appeng.client.gui.widgets.GuiTabButton; +import appeng.container.AEBaseContainer; +import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.container.ContainerItemAmountChange; +import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal; +import com.glodblock.github.common.part.PartFluidPatternTerminal; +import com.glodblock.github.inventory.GuiType; +import com.glodblock.github.loader.FCItems; +import com.glodblock.github.network.CPacketPatternValueSet; +import com.glodblock.github.network.CPacketSwitchGuis; +import com.glodblock.github.util.Ae2ReflectClient; +import com.glodblock.github.util.NameConst; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class GuiItemAmountChange extends GuiCraftAmount { + + private GuiType originalGui; + private GuiTabButton originalGuiBtn; + private GuiButton next; + private GuiNumberBox amountToCraft; + private GuiButton plus1; + private GuiButton plus10; + private GuiButton plus100; + private GuiButton plus1000; + private GuiButton minus1; + private GuiButton minus10; + private GuiButton minus100; + private GuiButton minus1000; + + public GuiItemAmountChange(InventoryPlayer inventoryPlayer, ITerminalHost te) { + super(inventoryPlayer, te); + this.inventorySlots = new ContainerItemAmountChange(inventoryPlayer, te); + } + + @Override + public void initGui() { + super.initGui(); + ItemStack myIcon = null; + Object target = ((AEBaseContainer)this.inventorySlots).getTarget(); + this.originalGuiBtn = Ae2ReflectClient.getGuiCraftAmountBackButton(this); + this.buttonList.remove(this.originalGuiBtn); + + if (target instanceof PartFluidPatternTerminal) { + myIcon = new ItemStack(FCItems.PART_FLUID_PATTERN_TERMINAL); + this.originalGui = GuiType.FLUID_PATTERN_TERMINAL; + } + + if (target instanceof PartExtendedFluidPatternTerminal) { + myIcon = new ItemStack(FCItems.PART_EXTENDED_FLUID_PATTERN_TERMINAL); + this.originalGui = GuiType.FLUID_EXTENDED_PATTERN_TERMINAL; + } + + if (this.originalGui != null && myIcon != null) { + this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender)); + } + + next = Ae2ReflectClient.getGuiCraftAmountNextButton(this); + amountToCraft = Ae2ReflectClient.getGuiCraftAmountTextBox(this); + plus1 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, 1); + plus10 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, 2); + plus100 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, 3); + plus1000 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, 4); + minus1 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, -1); + minus10 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, -2); + minus100 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, -3); + minus1000 = Ae2ReflectClient.getGuiCraftAmountAddButton(this, -4); + } + + @Override + public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { + this.fontRenderer.drawString(I18n.format(NameConst.GUI_ITEM_AMOUNT_SET), 8, 6, 4210752); + } + + @Override + public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawBG(offsetX, offsetY, mouseX, mouseY); + this.next.displayString = I18n.format(NameConst.GUI_ITEM_AMOUNT_SET_CONFIRM); + } + + @Override + protected void actionPerformed( final GuiButton btn ) { + try + { + if( btn == this.originalGuiBtn ) + { + FluidCraft.proxy.netHandler.sendToServer( new CPacketSwitchGuis( this.originalGui ) ); + } + + if( btn == this.next ) + { + FluidCraft.proxy.netHandler.sendToServer( new CPacketPatternValueSet(this.originalGui, Integer.parseInt(this.amountToCraft.getText()), ((ContainerItemAmountChange) this.inventorySlots).getValueIndex())); + } + } + catch( final NumberFormatException e ) + { + // nope.. + this.amountToCraft.setText( "1" ); + } + + final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000; + final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000; + + if( isPlus || isMinus ) + { + Ae2ReflectClient.setGuiCraftAmountAddQty(this, this.getQty( btn )); + } + } + +} diff --git a/src/main/java/com/glodblock/github/client/GuiItemDualInterface.java b/src/main/java/com/glodblock/github/client/GuiItemDualInterface.java index 60dde6ed2..b29063a24 100644 --- a/src/main/java/com/glodblock/github/client/GuiItemDualInterface.java +++ b/src/main/java/com/glodblock/github/client/GuiItemDualInterface.java @@ -4,8 +4,12 @@ import appeng.client.gui.implementations.GuiInterface; import appeng.client.gui.widgets.GuiTabButton; import appeng.helpers.IInterfaceHost; +import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.button.GuiFCImgButton; +import com.glodblock.github.client.container.ContainerItemDualInterface; import com.glodblock.github.inventory.GuiType; import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.network.CPacketFluidPatternTermBtns; import com.glodblock.github.util.Ae2ReflectClient; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; @@ -15,11 +19,18 @@ public class GuiItemDualInterface extends GuiInterface { + private final ContainerItemDualInterface container; + private GuiTabButton switchInterface; private GuiTabButton priorityBtn; + private GuiFCImgButton fluidPacketOffBtn; + private GuiFCImgButton fluidPacketOnBtn; public GuiItemDualInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) { super(inventoryPlayer, te); + this.container = new ContainerItemDualInterface(inventoryPlayer, te); + this.inventorySlots = container; + Ae2ReflectClient.setInterfaceContainer(this, this.container); } @Override @@ -28,6 +39,10 @@ protected void addButtons() { ItemStack icon = AEApi.instance().definitions().blocks().fluidIface().maybeStack(1).orElse(ItemStack.EMPTY); switchInterface = new GuiTabButton(guiLeft + 133, guiTop, icon, icon.getDisplayName(), itemRender); buttonList.add(switchInterface); + fluidPacketOffBtn = new GuiFCImgButton(this.guiLeft - 18, this.guiTop + 44, "SEND_FLUID", "REAL_FLUID"); + buttonList.add(fluidPacketOffBtn); + fluidPacketOnBtn = new GuiFCImgButton(this.guiLeft - 18, this.guiTop + 44, "SEND_PACKET", "FLUID_PACKET"); + buttonList.add(fluidPacketOnBtn); priorityBtn = Ae2ReflectClient.getPriorityButton(this); } @@ -42,9 +57,24 @@ protected void actionPerformed(final GuiButton btn) throws IOException { InventoryHandler.switchGui(GuiType.DUAL_FLUID_INTERFACE); } else if (btn == priorityBtn) { InventoryHandler.switchGui(GuiType.PRIORITY); + } else if (btn == fluidPacketOffBtn || btn == fluidPacketOnBtn) { + FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("DualInterface.FluidPacket", btn == fluidPacketOnBtn ? "0" : "1")); } else { super.actionPerformed(btn); } } + @Override + public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { + if (this.container.fluidPacket) { + this.fluidPacketOnBtn.visible = true; + this.fluidPacketOffBtn.visible = false; + } + else { + this.fluidPacketOnBtn.visible = false; + this.fluidPacketOffBtn.visible = true; + } + super.drawFG(offsetX, offsetY, mouseX, mouseY); + } + } \ No newline at end of file diff --git a/src/main/java/com/glodblock/github/client/button/GuiFCImgButton.java b/src/main/java/com/glodblock/github/client/button/GuiFCImgButton.java index 37862b69d..d5c8b6f88 100644 --- a/src/main/java/com/glodblock/github/client/button/GuiFCImgButton.java +++ b/src/main/java/com/glodblock/github/client/button/GuiFCImgButton.java @@ -38,6 +38,10 @@ public GuiFCImgButton( final int x, final int y, final String idx, final String appearances = new HashMap<>(); this.registerApp( 0, "NOT_COMBINE", "DONT_COMBINE", "not_combine" ); this.registerApp( 1, "FORCE_COMBINE", "DO_COMBINE", "combine" ); + this.registerApp( 2, "SEND_FLUID", "REAL_FLUID", "real_fluid" ); + this.registerApp( 3, "SEND_PACKET", "FLUID_PACKET", "fake_packet" ); + this.registerApp( 4, "FLUID_FIRST", "FLUID", "fluid_first" ); + this.registerApp( 5, "ORIGIN_ORDER", "ITEM", "origin_order" ); } } @@ -231,6 +235,10 @@ public void drawButton(@Nonnull final Minecraft par1Minecraft, final int par2, f } else { + GL11.glPushMatrix(); + GL11.glTranslatef( this.x, this.y, 0.0F ); + GL11.glScalef( 1f / 16 * 3, 1f / 16 * 3, 1f / 16 * 3 ); + if( this.enabled ) { GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); @@ -246,9 +254,11 @@ public void drawButton(@Nonnull final Minecraft par1Minecraft, final int par2, f final int uv_y = (int) Math.floor( iconIndex / 3.0 ); final int uv_x = iconIndex - uv_y * 3; - this.drawTexturedModalRect( this.x, this.y, 32, 32, 16, 16 ); - this.drawTexturedModalRect( this.x, this.y, uv_x * 16, uv_y * 16, 16, 16 ); + this.drawTexturedModalRect( 0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) ); + this.drawTexturedModalRect( 0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) ); this.mouseDragged( par1Minecraft, par2, par3 ); + + GL11.glPopMatrix(); } } GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); diff --git a/src/main/java/com/glodblock/github/client/client/gui/GuiWrapInterface.java b/src/main/java/com/glodblock/github/client/client/gui/GuiWrapInterface.java new file mode 100644 index 000000000..2e7d9f747 --- /dev/null +++ b/src/main/java/com/glodblock/github/client/client/gui/GuiWrapInterface.java @@ -0,0 +1,60 @@ +package com.glodblock.github.client.client.gui; + +import appeng.client.gui.implementations.GuiInterface; +import appeng.helpers.IInterfaceHost; +import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.button.GuiFCImgButton; +import com.glodblock.github.client.container.ContainerWrapInterface; +import com.glodblock.github.network.CPacketFluidPatternTermBtns; +import com.glodblock.github.util.Ae2ReflectClient; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.InventoryPlayer; + +import java.io.IOException; + +public class GuiWrapInterface extends GuiInterface { + //fuck ae2 + private final ContainerWrapInterface container; + + private GuiFCImgButton fluidPacketOffBtn; + private GuiFCImgButton fluidPacketOnBtn; + + public GuiWrapInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) { + super(inventoryPlayer, te); + this.container = new ContainerWrapInterface(inventoryPlayer, te); + this.inventorySlots = container; + Ae2ReflectClient.setInterfaceContainer(this, this.container); + } + + @Override + protected void addButtons() { + super.addButtons(); + fluidPacketOffBtn = new GuiFCImgButton(this.guiLeft - 18, this.guiTop + 44, "SEND_FLUID", "REAL_FLUID"); + buttonList.add(fluidPacketOffBtn); + fluidPacketOnBtn = new GuiFCImgButton(this.guiLeft - 18, this.guiTop + 44, "SEND_PACKET", "FLUID_PACKET"); + buttonList.add(fluidPacketOnBtn); + } + + @Override + protected void actionPerformed(final GuiButton btn) throws IOException { + if (btn == fluidPacketOffBtn || btn == fluidPacketOnBtn) { + FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("WrapDualInterface.FluidPacket", btn == fluidPacketOnBtn ? "0" : "1")); + } else { + super.actionPerformed(btn); + } + } + + @Override + public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { + if (this.container.fluidPacket) { + this.fluidPacketOnBtn.visible = true; + this.fluidPacketOffBtn.visible = false; + } + else { + this.fluidPacketOnBtn.visible = false; + this.fluidPacketOffBtn.visible = true; + } + super.drawFG(offsetX, offsetY, mouseX, mouseY); + } + +} diff --git a/src/main/java/com/glodblock/github/client/container/ContainerExtendedFluidPatternTerminal.java b/src/main/java/com/glodblock/github/client/container/ContainerExtendedFluidPatternTerminal.java index e26c0f52a..1ebdbc995 100644 --- a/src/main/java/com/glodblock/github/client/container/ContainerExtendedFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/client/container/ContainerExtendedFluidPatternTerminal.java @@ -9,6 +9,7 @@ import appeng.container.slot.SlotFakeCraftingMatrix; import appeng.container.slot.SlotPatternOutputs; import appeng.helpers.InventoryAction; +import appeng.items.misc.ItemEncodedPattern; import appeng.util.Platform; import appeng.util.item.AEItemStack; import com.glodblock.github.common.item.ItemFluidDrop; @@ -32,6 +33,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Optional; public class ContainerExtendedFluidPatternTerminal extends ContainerExpandedProcessingPatternTerm implements PatternConsumer { @@ -43,6 +45,8 @@ public class ContainerExtendedFluidPatternTerminal extends ContainerExpandedProc @GuiSync(95) public boolean combine = false; + @GuiSync(96) + public boolean fluidFirst = false; public ContainerExtendedFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) { super(ip, monitorable); @@ -444,6 +448,7 @@ public void detectAndSendChanges() { super.detectAndSendChanges(); if (Platform.isServer()) { this.combine = ((PartExtendedFluidPatternTerminal) this.getExpandedPatternTerminal()).getCombineMode(); + this.fluidFirst = ((PartExtendedFluidPatternTerminal) this.getExpandedPatternTerminal()).getFluidPlaceMode(); } } diff --git a/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java b/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java index 56549867e..88f624277 100644 --- a/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/client/container/ContainerFluidPatternTerminal.java @@ -41,6 +41,8 @@ public class ContainerFluidPatternTerminal extends ContainerPatternTerm implemen @GuiSync(95) public boolean combine = false; + @GuiSync(96) + public boolean fluidFirst = false; public ContainerFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) { super(ip, monitorable); @@ -448,6 +450,7 @@ public void detectAndSendChanges() { super.detectAndSendChanges(); if (Platform.isServer()) { this.combine = ((PartFluidPatternTerminal) this.getPatternTerminal()).getCombineMode(); + this.fluidFirst = ((PartFluidPatternTerminal) this.getPatternTerminal()).getFluidPlaceMode(); } } diff --git a/src/main/java/com/glodblock/github/client/container/ContainerItemAmountChange.java b/src/main/java/com/glodblock/github/client/container/ContainerItemAmountChange.java new file mode 100644 index 000000000..6743872bf --- /dev/null +++ b/src/main/java/com/glodblock/github/client/container/ContainerItemAmountChange.java @@ -0,0 +1,57 @@ +package com.glodblock.github.client.container; + +import appeng.api.config.SecurityPermissions; +import appeng.api.storage.ITerminalHost; +import appeng.container.AEBaseContainer; +import appeng.container.guisync.GuiSync; +import appeng.container.slot.SlotInaccessible; +import appeng.tile.inventory.AppEngInternalInventory; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; + +public class ContainerItemAmountChange extends AEBaseContainer { + + private final Slot patternValue; + @GuiSync(10) + public long initValue; + @GuiSync(11) + public int valueIndex; + + public ContainerItemAmountChange(final InventoryPlayer ip, final ITerminalHost te ) + { + super( ip, te ); + this.patternValue = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 ); + this.addSlotToContainer( patternValue ); + } + + @Override + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + this.verifyPermissions( SecurityPermissions.CRAFT, false ); + } + + public Slot getPatternValue() + { + return patternValue; + } + + public int getValueIndex() + { + return valueIndex; + } + + public void setValueIndex( int valueIndex ) + { + this.valueIndex = valueIndex; + } + + public void setInitValue( long value ) { + this.initValue = value; + } + + public long getInitValue() { + return this.initValue; + } + +} diff --git a/src/main/java/com/glodblock/github/client/container/ContainerItemDualInterface.java b/src/main/java/com/glodblock/github/client/container/ContainerItemDualInterface.java new file mode 100644 index 000000000..8b665ae94 --- /dev/null +++ b/src/main/java/com/glodblock/github/client/container/ContainerItemDualInterface.java @@ -0,0 +1,35 @@ +package com.glodblock.github.client.container; + +import appeng.container.guisync.GuiSync; +import appeng.container.implementations.ContainerInterface; +import appeng.helpers.DualityInterface; +import appeng.helpers.IInterfaceHost; +import appeng.util.Platform; +import com.glodblock.github.util.Ae2Reflect; +import net.minecraft.entity.player.InventoryPlayer; + +public class ContainerItemDualInterface extends ContainerInterface { + + @GuiSync(95) + public boolean fluidPacket = false; + private final DualityInterface dualityInterfaceCopy; + + public ContainerItemDualInterface(InventoryPlayer ip, IInterfaceHost te) { + super(ip, te); + this.dualityInterfaceCopy = te.getInterfaceDuality(); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (Platform.isServer()) { + fluidPacket = Ae2Reflect.getFluidPacketMode(dualityInterfaceCopy); + } + } + + public void setFluidPacketInTile(boolean value) { + this.fluidPacket = value; + Ae2Reflect.setFluidPacketMode(dualityInterfaceCopy, value); + } + +} diff --git a/src/main/java/com/glodblock/github/client/container/ContainerWrapInterface.java b/src/main/java/com/glodblock/github/client/container/ContainerWrapInterface.java new file mode 100644 index 000000000..018a8ed23 --- /dev/null +++ b/src/main/java/com/glodblock/github/client/container/ContainerWrapInterface.java @@ -0,0 +1,35 @@ +package com.glodblock.github.client.container; + +import appeng.container.guisync.GuiSync; +import appeng.container.implementations.ContainerInterface; +import appeng.helpers.DualityInterface; +import appeng.helpers.IInterfaceHost; +import appeng.util.Platform; +import com.glodblock.github.util.Ae2Reflect; +import net.minecraft.entity.player.InventoryPlayer; + +public class ContainerWrapInterface extends ContainerInterface { + + @GuiSync(95) + public boolean fluidPacket = false; + private final DualityInterface dualityInterfaceCopy; + + public ContainerWrapInterface(InventoryPlayer ip, IInterfaceHost te) { + super(ip, te); + this.dualityInterfaceCopy = te.getInterfaceDuality(); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (Platform.isServer()) { + fluidPacket = Ae2Reflect.getFluidPacketMode(dualityInterfaceCopy); + } + } + + public void setFluidPacketInTile(boolean value) { + this.fluidPacket = value; + Ae2Reflect.setFluidPacketMode(dualityInterfaceCopy, value); + } + +} diff --git a/src/main/java/com/glodblock/github/common/part/PartExtendedFluidPatternTerminal.java b/src/main/java/com/glodblock/github/common/part/PartExtendedFluidPatternTerminal.java index f48fd8464..f0965543b 100644 --- a/src/main/java/com/glodblock/github/common/part/PartExtendedFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/common/part/PartExtendedFluidPatternTerminal.java @@ -14,8 +14,10 @@ import com.glodblock.github.common.item.ItemFluidDrop; import com.glodblock.github.common.item.ItemFluidEncodedPattern; import com.glodblock.github.common.item.ItemFluidPacket; +import com.glodblock.github.inventory.ExAppEngInternalInventory; import com.glodblock.github.inventory.GuiType; import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.util.Ae2Reflect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -31,6 +33,7 @@ public class PartExtendedFluidPatternTerminal extends PartExpandedProcessingPatternTerminal { private boolean combine = false; + private boolean fluidFirst = false; @PartModels public static ResourceLocation[] MODELS = new ResourceLocation[] { @@ -44,6 +47,9 @@ public class PartExtendedFluidPatternTerminal extends PartExpandedProcessingPatt public PartExtendedFluidPatternTerminal(ItemStack is) { super(is); + ExAppEngInternalInventory exCraft = new ExAppEngInternalInventory((AppEngInternalInventory) getInventoryByName("crafting")); + ExAppEngInternalInventory exOutput = new ExAppEngInternalInventory((AppEngInternalInventory) getInventoryByName("output")); + Ae2Reflect.setInventoryForPart(this, exCraft, exOutput); } @Nonnull @@ -137,12 +143,14 @@ public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutpu public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); combine = data.getBoolean("combineMode"); + fluidFirst = data.getBoolean("fluidFirst"); } @Override public void writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean("combineMode", combine); + data.setBoolean("fluidFirst", fluidFirst); } public void setCombineMode(boolean value) { @@ -153,4 +161,12 @@ public boolean getCombineMode() { return this.combine; } + public void setFluidPlaceMode(boolean value) { + this.fluidFirst = value; + } + + public boolean getFluidPlaceMode() { + return this.fluidFirst; + } + } diff --git a/src/main/java/com/glodblock/github/common/part/PartFluidPatternTerminal.java b/src/main/java/com/glodblock/github/common/part/PartFluidPatternTerminal.java index 3f8fb09e3..99306be56 100644 --- a/src/main/java/com/glodblock/github/common/part/PartFluidPatternTerminal.java +++ b/src/main/java/com/glodblock/github/common/part/PartFluidPatternTerminal.java @@ -14,8 +14,10 @@ import com.glodblock.github.common.item.ItemFluidDrop; import com.glodblock.github.common.item.ItemFluidEncodedPattern; import com.glodblock.github.common.item.ItemFluidPacket; +import com.glodblock.github.inventory.ExAppEngInternalInventory; import com.glodblock.github.inventory.GuiType; import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.util.Ae2Reflect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -31,6 +33,7 @@ public class PartFluidPatternTerminal extends PartPatternTerminal { private boolean combine = false; + private boolean fluidFirst = false; @PartModels public static ResourceLocation[] MODELS = new ResourceLocation[] { @@ -44,6 +47,9 @@ public class PartFluidPatternTerminal extends PartPatternTerminal { public PartFluidPatternTerminal(ItemStack is) { super(is); + ExAppEngInternalInventory exCraft = new ExAppEngInternalInventory((AppEngInternalInventory) getInventoryByName("crafting")); + ExAppEngInternalInventory exOutput = new ExAppEngInternalInventory((AppEngInternalInventory) getInventoryByName("output")); + Ae2Reflect.setInventoryForPart(this, exCraft, exOutput); } @Nonnull @@ -56,6 +62,7 @@ public IPartModel getStaticModels() { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); combine = data.getBoolean("combineMode"); + fluidFirst = data.getBoolean("fluidFirst"); } public void setCombineMode(boolean value) { @@ -66,10 +73,19 @@ public boolean getCombineMode() { return this.combine; } + public void setFluidPlaceMode(boolean value) { + this.fluidFirst = value; + } + + public boolean getFluidPlaceMode() { + return this.fluidFirst; + } + @Override public void writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean("combineMode", combine); + data.setBoolean("fluidFirst", fluidFirst); } @Override diff --git a/src/main/java/com/glodblock/github/coremod/CoreModHooks.java b/src/main/java/com/glodblock/github/coremod/CoreModHooks.java index edebb64b2..6d91813a6 100644 --- a/src/main/java/com/glodblock/github/coremod/CoreModHooks.java +++ b/src/main/java/com/glodblock/github/coremod/CoreModHooks.java @@ -13,17 +13,15 @@ import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEItemStack; import appeng.crafting.MECraftingInventory; -import appeng.items.misc.ItemEncodedPattern; +import appeng.helpers.DualityInterface; 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 appeng.util.inv.BlockingInventoryAdaptor; -import appeng.util.inv.filter.IAEItemFilter; import appeng.util.item.AEItemStack; import com.glodblock.github.common.item.ItemFluidDrop; -import com.glodblock.github.common.item.ItemFluidEncodedPattern; import com.glodblock.github.common.item.ItemFluidPacket; import com.glodblock.github.common.part.PartDualInterface; import com.glodblock.github.common.tile.TileDualInterface; @@ -34,8 +32,10 @@ import com.glodblock.github.loader.FCItems; import com.glodblock.github.util.Ae2Reflect; import com.glodblock.github.util.SetBackedMachineSet; +import com.google.common.collect.Sets; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -48,7 +48,6 @@ import javax.annotation.Nullable; import java.util.HashSet; import java.util.Set; -import com.google.common.collect.Sets; public class CoreModHooks { @@ -76,6 +75,25 @@ public static BlockingInventoryAdaptor wrapBlockInventory(@Nullable TileEntity t return tile != null ? BlockingFluidInventoryAdaptor.getAdaptor(tile, face) : null; } + public static void writeExtraNBTInterface(DualityInterface dual, NBTTagCompound nbt) { + nbt.setBoolean("fluidPacket", Ae2Reflect.getFluidPacketMode(dual)); + } + + public static void readExtraNBTInterface(DualityInterface dual, NBTTagCompound nbt) { + Ae2Reflect.setFluidPacketMode(dual, nbt.getBoolean("fluidPacket")); + } + + public static ItemStack removeFluidPackets(InventoryCrafting inv, int index) { + ItemStack stack = inv.getStackInSlot(index); + if (stack != ItemStack.EMPTY && stack.getItem() instanceof ItemFluidPacket) { + FluidStack fluid = ItemFluidPacket.getFluidStack(stack); + return ItemFluidDrop.newStack(fluid); + } + else { + return stack; + } + } + public static long getCraftingByteCost(IAEItemStack stack) { return stack.getItem() instanceof ItemFluidDrop ? (long)Math.ceil(stack.getStackSize() / 1000D) : stack.getStackSize(); @@ -109,6 +127,13 @@ public static IMachineSet getMachines(IGrid grid, Class c) } } + public static Object wrapFluidPacket(ItemStack stack) { + if (stack.getItem() instanceof ItemFluidPacket) { + return ItemFluidPacket.getFluidStack(stack); + } + return stack; + } + private static IMachineSet unionMachineSets(IMachineSet a, IMachineSet b) { if (a.isEmpty()) { return b; diff --git a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java index d7e4c2eec..2f35de06d 100644 --- a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java +++ b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java @@ -24,6 +24,9 @@ public byte[] transform(String name, String transformedName, byte[] code) { case "appeng.items.parts.PartType": tform = PartTypeTransformer.INSTANCE; break; + case "appeng.core.sync.GuiBridge": + tform = GuiBridgeTransformer.INSTANCE; + break; case "thelm.packagedauto.integration.appeng.recipe.PackageCraftingPatternHelper": tform = PautoCraftingPatternHelperTransformer.TFORM_INPUTS; break; @@ -33,7 +36,11 @@ public byte[] transform(String name, String transformedName, byte[] code) { case "thelm.packagedauto.tile.TileUnpackager": tform = TileUnpackagerTransformer.INSTANCE; break; + case "mezz.jei.input.GuiContainerWrapper": + tform = GuiContainerWrapperTransformer.INSTANCE; + break; case "appeng.container.implementations.ContainerInterfaceTerminal": + case "appeng.container.implementations.ContainerInterfaceConfigurationTerminal": tform = ContainerInterfaceTerminalTransformer.INSTANCE; break; case "appeng.client.gui.implementations.GuiCraftingCPU": diff --git a/src/main/java/com/glodblock/github/coremod/transform/CraftingCpuTransformer.java b/src/main/java/com/glodblock/github/coremod/transform/CraftingCpuTransformer.java index 2eab83537..57329aff5 100644 --- a/src/main/java/com/glodblock/github/coremod/transform/CraftingCpuTransformer.java +++ b/src/main/java/com/glodblock/github/coremod/transform/CraftingCpuTransformer.java @@ -83,6 +83,15 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, 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/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 diff --git a/src/main/java/com/glodblock/github/coremod/transform/DualityInterfaceTransformer.java b/src/main/java/com/glodblock/github/coremod/transform/DualityInterfaceTransformer.java index e64db3881..18117f21b 100644 --- a/src/main/java/com/glodblock/github/coremod/transform/DualityInterfaceTransformer.java +++ b/src/main/java/com/glodblock/github/coremod/transform/DualityInterfaceTransformer.java @@ -1,9 +1,7 @@ package com.glodblock.github.coremod.transform; 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.*; public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper { @@ -15,6 +13,9 @@ private DualityInterfaceTransformer() { @Override protected ClassVisitor getClassMapper(ClassVisitor downstream) { + FieldVisitor fv = downstream.visitField(Opcodes.ACC_PUBLIC, "fluidPacket", "Z", null, false); + fv.visitEnd(); + return new TransformDualityInterface(Opcodes.ASM5, downstream); } @@ -33,6 +34,10 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si return new TransformInvAdaptorCalls(api, super.visitMethod(access, name, desc, signature, exceptions)); case "isCustomInvBlocking": return new TransformBlockAdaptorCalls(api, super.visitMethod(access, name, desc, signature, exceptions)); + case "writeToNBT": + return new TransformNBTIO(api, super.visitMethod(access, name, desc, signature, exceptions), false); + case "readFromNBT": + return new TransformNBTIO(api, super.visitMethod(access, name, desc, signature, exceptions), true); default: return super.visitMethod(access, name, desc, signature, exceptions); } @@ -40,6 +45,37 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si } + private static class TransformNBTIO extends MethodVisitor { + + boolean in; + + TransformNBTIO(int api, MethodVisitor mv, boolean mode) { + super(api, mv); + this.in = mode; + } + + @Override + public void visitCode() { + super.visitCode(); + super.visitVarInsn(Opcodes.ALOAD, 0); + super.visitVarInsn(Opcodes.ALOAD, 1); + if (in) { + super.visitMethodInsn(Opcodes.INVOKESTATIC, + "com/glodblock/github/coremod/CoreModHooks", + "readExtraNBTInterface", + "(Lappeng/helpers/DualityInterface;Lnet/minecraft/nbt/NBTTagCompound;)V", + false); + } else { + super.visitMethodInsn(Opcodes.INVOKESTATIC, + "com/glodblock/github/coremod/CoreModHooks", + "writeExtraNBTInterface", + "(Lappeng/helpers/DualityInterface;Lnet/minecraft/nbt/NBTTagCompound;)V", + false); + } + } + + } + private static class TransformInvAdaptorCalls extends MethodVisitor { TransformInvAdaptorCalls(int api, MethodVisitor mv) { diff --git a/src/main/java/com/glodblock/github/coremod/transform/GuiBridgeTransformer.java b/src/main/java/com/glodblock/github/coremod/transform/GuiBridgeTransformer.java new file mode 100644 index 000000000..fd40b1f2b --- /dev/null +++ b/src/main/java/com/glodblock/github/coremod/transform/GuiBridgeTransformer.java @@ -0,0 +1,56 @@ +package com.glodblock.github.coremod.transform; + +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.Type; + +public class GuiBridgeTransformer extends FCClassTransformer.ClassMapper { + + public static final GuiBridgeTransformer INSTANCE = new GuiBridgeTransformer(); + + private GuiBridgeTransformer() { + // NO-OP + } + + @Override + protected ClassVisitor getClassMapper(ClassVisitor downstream) { + return new TransformerGuiBridge(Opcodes.ASM5, downstream); + } + + private static class TransformerGuiBridge extends ClassVisitor { + + TransformerGuiBridge(int api, ClassVisitor cv) { + super(api, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + if (name.equals("")) { + return new InterfaceContainerTransformer(api, super.visitMethod(access, name, desc, signature, exceptions)); + } + return super.visitMethod(access, name, desc, signature, exceptions); + } + + } + + private static class InterfaceContainerTransformer extends MethodVisitor { + + InterfaceContainerTransformer(int api, MethodVisitor mv) { + super(api, mv); + } + + @Override + public void visitLdcInsn(Object cst) { + if (Type.getType("Lappeng/container/implementations/ContainerInterface;").equals(cst)) { + super.visitLdcInsn(Type.getType("Lcom/glodblock/github/client/container/ContainerWrapInterface;")); + } else { + super.visitLdcInsn(cst); + } + } + + } + + +} diff --git a/src/main/java/com/glodblock/github/coremod/transform/GuiContainerWrapperTransformer.java b/src/main/java/com/glodblock/github/coremod/transform/GuiContainerWrapperTransformer.java new file mode 100644 index 000000000..4499f6bd6 --- /dev/null +++ b/src/main/java/com/glodblock/github/coremod/transform/GuiContainerWrapperTransformer.java @@ -0,0 +1,75 @@ +package com.glodblock.github.coremod.transform; + +import com.glodblock.github.coremod.FCClassTransformer; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +public class GuiContainerWrapperTransformer extends FCClassTransformer.ClassMapper { + + public static final GuiContainerWrapperTransformer INSTANCE = new GuiContainerWrapperTransformer(); + + public GuiContainerWrapperTransformer() { + // NO-OP + } + + @Override + protected ClassVisitor getClassMapper(ClassVisitor downstream) { + return new TransformGuiContainerWrapper(Opcodes.ASM5, downstream); + } + + private static class TransformGuiContainerWrapper extends ClassVisitor { + + public TransformGuiContainerWrapper(int api, ClassVisitor cv) { + super(api, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + if (name.equals("getIngredientUnderMouse")) { + return new TransformGetIngredient(api, super.visitMethod(access, name, desc, signature, exceptions)); + } + return super.visitMethod(access, name, desc, signature, exceptions); + } + + } + + private static class TransformGetIngredient extends MethodVisitor { + + int target = 0; + + public TransformGetIngredient(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("java/awt/Rectangle") && name.equals("")) { + if (target == 0) { + target = 1; + } + } + super.visitMethodInsn(opcode, owner, name, desc, itf); + } + + @Override + public void visitVarInsn(int opcode, int var) { + if (target == 1 && opcode == Opcodes.ALOAD && var == 6) { + target = 2; + super.visitVarInsn(Opcodes.ALOAD, 6); + super.visitMethodInsn(Opcodes.INVOKESTATIC, + "com/glodblock/github/coremod/CoreModHooks", + "wrapFluidPacket", + "(Lnet/minecraft/item/ItemStack;)Ljava/lang/Object;", + false); + super.visitVarInsn(Opcodes.ASTORE, 6); + super.visitVarInsn(Opcodes.ALOAD, 6); + } + else { + super.visitVarInsn(opcode, var); + } + } + + } + +} diff --git a/src/main/java/com/glodblock/github/integration/jei/ExtendedFluidPatternTerminalRecipeTransferHandler.java b/src/main/java/com/glodblock/github/integration/jei/ExtendedFluidPatternTerminalRecipeTransferHandler.java index 0a217d1ea..82cb33970 100644 --- a/src/main/java/com/glodblock/github/integration/jei/ExtendedFluidPatternTerminalRecipeTransferHandler.java +++ b/src/main/java/com/glodblock/github/integration/jei/ExtendedFluidPatternTerminalRecipeTransferHandler.java @@ -44,7 +44,7 @@ public IRecipeTransferError transferRecipe(@Nonnull ContainerExtendedFluidPatter PartExtendedFluidPatternTerminal tile = (PartExtendedFluidPatternTerminal)container.part; IAEItemStack[] crafting = new IAEItemStack[tile.getInventoryByName("crafting").getSlots()]; IAEItemStack[] output = new IAEItemStack[tile.getInventoryByName("output").getSlots()]; - FluidPatternEncoderRecipeTransferHandler.transferRecipeSlots(recipeLayout, crafting, output, false, container.combine, ext); + FluidPatternEncoderRecipeTransferHandler.transferRecipeSlots(recipeLayout, crafting, output, false, container.combine, container.fluidFirst, ext); FluidCraft.proxy.netHandler.sendToServer(new CPacketLoadPattern(crafting, output)); } return null; diff --git a/src/main/java/com/glodblock/github/integration/jei/FluidPatternEncoderRecipeTransferHandler.java b/src/main/java/com/glodblock/github/integration/jei/FluidPatternEncoderRecipeTransferHandler.java index 12890f5b2..31dc0df0f 100644 --- a/src/main/java/com/glodblock/github/integration/jei/FluidPatternEncoderRecipeTransferHandler.java +++ b/src/main/java/com/glodblock/github/integration/jei/FluidPatternEncoderRecipeTransferHandler.java @@ -49,14 +49,14 @@ public IRecipeTransferError transferRecipe(@Nonnull ContainerFluidPatternEncoder TileFluidPatternEncoder tile = container.getTile(); IAEItemStack[] crafting = new IAEItemStack[tile.getCraftingSlots().getSlotCount()]; IAEItemStack[] output = new IAEItemStack[tile.getOutputSlots().getSlotCount()]; - transferRecipeSlots(recipeLayout, crafting, output, false, false, ext); + transferRecipeSlots(recipeLayout, crafting, output, false, false, false, ext); FluidCraft.proxy.netHandler.sendToServer(new CPacketLoadPattern(crafting, output)); } return null; } public static void transferRecipeSlots(IRecipeLayout recipeLayout, IAEItemStack[] crafting, IAEItemStack[] output, - boolean retainEmptyInputs, boolean doCompress, ExtraExtractors ext) { + boolean retainEmptyInputs, boolean doCompress, boolean fluidFirst, ExtraExtractors ext) { //Clear Current Terminal Arrays.fill(crafting, null); Arrays.fill(output, null); @@ -85,44 +85,18 @@ public static void transferRecipeSlots(IRecipeLayout recipeLayout, IAEItemStack[ } } - for (int i = 0; i < Math.min(crafting.length, inputItems.size()); i ++) { - if (inputItems.get(i) != null) { - crafting[i] = AEItemStack.fromItemStack(inputItems.get(i)); - } - ndxCrafting = i + 1; + if (fluidFirst) { + ndxCrafting = encodeFluid(recipeLayout, crafting, ext, 0, true); + ndxCrafting = encodeItem(inputItems, crafting, ndxCrafting); + ndxOutput = encodeFluid(recipeLayout, output, ext, 0, false); + ndxOutput = encodeItem(outputItems, output, ndxOutput); + } else { + ndxCrafting = encodeItem(inputItems, crafting, 0); + ndxCrafting = encodeFluid(recipeLayout, crafting, ext, ndxCrafting, true); + ndxOutput = encodeItem(outputItems, output, 0); + ndxOutput = encodeFluid(recipeLayout, output, ext, ndxOutput, false); } - for (int i = 0; i < Math.min(output.length, outputItems.size()); i ++) { - if (outputItems.get(i) != null) { - output[i] = AEItemStack.fromItemStack(outputItems.get(i)); - } - ndxOutput = i + 1; - } - - for (IGuiIngredient ing : recipeLayout.getFluidStacks().getGuiIngredients().values()) { - if (ing.isInput()) { - if (ndxCrafting < crafting.length) { - crafting[ndxCrafting++] = ItemFluidPacket.newAeStack(ing.getDisplayedIngredient()); - } - } else { - if (ndxOutput < output.length) { - output[ndxOutput++] = ItemFluidPacket.newAeStack(ing.getDisplayedIngredient()); - } - } - } - Iterator> iter = ext.extractFluids(recipeLayout).iterator(); - while (iter.hasNext()) { - WrappedIngredient ing = iter.next(); - if (ing.isInput()) { - if (ndxCrafting < crafting.length) { - crafting[ndxCrafting++] = ItemFluidPacket.newAeStack(ing.getIngredient()); - } - } else { - if (ndxOutput < output.length) { - output[ndxOutput++] = ItemFluidPacket.newAeStack(ing.getIngredient()); - } - } - } } public static List compress(Collection list) { @@ -147,4 +121,34 @@ public static List compress(Collection list) { return comp.stream().filter(Objects::nonNull).collect(Collectors.toList()); } + private static int encodeFluid(IRecipeLayout recipeLayout, IAEItemStack[] array, ExtraExtractors ext, int index, boolean isInput) { + for (IGuiIngredient ing : recipeLayout.getFluidStacks().getGuiIngredients().values()) { + if (ing.isInput() == isInput) { + if (index < array.length && ing.getDisplayedIngredient() != null) { + array[index++] = ItemFluidPacket.newAeStack(ing.getDisplayedIngredient()); + } + } + } + Iterator> iter = ext.extractFluids(recipeLayout).iterator(); + while (iter.hasNext()) { + WrappedIngredient ing = iter.next(); + if (ing.isInput() == isInput) { + if (index < array.length && ing.getIngredient() != null) { + array[index++] = ItemFluidPacket.newAeStack(ing.getIngredient()); + } + } + } + return index; + } + + private static int encodeItem(Collection itemList, IAEItemStack[] array, int index) { + for (ItemStack item : itemList) { + if (item != null && index < array.length) { + array[index] = AEItemStack.fromItemStack(item); + } + index ++; + } + return index; + } + } diff --git a/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java b/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java index 691558e21..f248be2cc 100644 --- a/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java +++ b/src/main/java/com/glodblock/github/integration/jei/FluidPatternTerminalRecipeTransferHandler.java @@ -50,7 +50,7 @@ else if (!container.isCraftingMode() && recipeLayout.getRecipeCategory().getUid( PartFluidPatternTerminal tile = (PartFluidPatternTerminal)container.getPatternTerminal(); IAEItemStack[] crafting = new IAEItemStack[tile.getInventoryByName("crafting").getSlots()]; IAEItemStack[] output = new IAEItemStack[tile.getInventoryByName("output").getSlots()]; - FluidPatternEncoderRecipeTransferHandler.transferRecipeSlots(recipeLayout, crafting, output, container.craftingMode, container.combine, ext); + FluidPatternEncoderRecipeTransferHandler.transferRecipeSlots(recipeLayout, crafting, output, container.craftingMode, container.combine, container.fluidFirst, ext); FluidCraft.proxy.netHandler.sendToServer(new CPacketLoadPattern(crafting, output)); } return null; diff --git a/src/main/java/com/glodblock/github/inventory/BlockingFluidInventoryAdaptor.java b/src/main/java/com/glodblock/github/inventory/BlockingFluidInventoryAdaptor.java index e1d46b629..c7aac23b3 100644 --- a/src/main/java/com/glodblock/github/inventory/BlockingFluidInventoryAdaptor.java +++ b/src/main/java/com/glodblock/github/inventory/BlockingFluidInventoryAdaptor.java @@ -15,6 +15,7 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Iterator; import java.util.Objects; @@ -80,11 +81,13 @@ public boolean containsBlockingItems() { return !(fluidPass && itemPass); } + @Nonnull @Override public Iterator iterator() { return new ItemHandlerIterator(this.invItems); } + @SuppressWarnings("rawtypes") boolean isBlockableItem(ItemStack stack) { Object2ObjectOpenHashMap map = NonBlockingItems.INSTANCE.getMap().get(this.domain); if (map.get(stack.getItem()) != null) { diff --git a/src/main/java/com/glodblock/github/inventory/ExAppEngInternalInventory.java b/src/main/java/com/glodblock/github/inventory/ExAppEngInternalInventory.java new file mode 100644 index 000000000..15f151d14 --- /dev/null +++ b/src/main/java/com/glodblock/github/inventory/ExAppEngInternalInventory.java @@ -0,0 +1,57 @@ +package com.glodblock.github.inventory; + +import appeng.tile.inventory.AppEngInternalInventory; +import com.glodblock.github.util.Ae2Reflect; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.util.Constants; + +public class ExAppEngInternalInventory extends AppEngInternalInventory { + + public ExAppEngInternalInventory(AppEngInternalInventory inv) { + super(inv.getTileEntity(), inv.getSlots(), inv.getSlotLimit(0), Ae2Reflect.getInventoryFilter(inv)); + } + + @Override + public NBTTagCompound serializeNBT() + { + NBTTagList nbtTagList = new NBTTagList(); + for (int i = 0; i < stacks.size(); i++) + { + if (!stacks.get(i).isEmpty()) + { + NBTTagCompound itemTag = new NBTTagCompound(); + itemTag.setInteger("Slot", i); + stacks.get(i).writeToNBT(itemTag); + itemTag.setInteger("Count", stacks.get(i).getCount()); + nbtTagList.appendTag(itemTag); + } + } + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("Items", nbtTagList); + nbt.setInteger("Size", stacks.size()); + return nbt; + } + + @Override + public void deserializeNBT(NBTTagCompound nbt) + { + setSize(nbt.hasKey("Size", Constants.NBT.TAG_INT) ? nbt.getInteger("Size") : stacks.size()); + NBTTagList tagList = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound itemTags = tagList.getCompoundTagAt(i); + int slot = itemTags.getInteger("Slot"); + + if (slot >= 0 && slot < stacks.size()) + { + ItemStack tmp = new ItemStack(itemTags); + tmp.setCount(itemTags.getInteger("Count")); + stacks.set(slot, tmp); + } + } + onLoad(); + } + +} diff --git a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java index 15626722d..933af97c7 100644 --- a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java +++ b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java @@ -1,6 +1,10 @@ package com.glodblock.github.inventory; import appeng.api.config.FuzzyMode; +import appeng.api.parts.IPart; +import appeng.helpers.DualityInterface; +import appeng.helpers.IInterfaceHost; +import appeng.tile.networking.TileCableBus; import appeng.util.InventoryAdaptor; import appeng.util.inv.AdaptorItemHandler; import appeng.util.inv.IInventoryDestination; @@ -9,6 +13,7 @@ import com.glodblock.github.common.item.ItemFluidPacket; import com.glodblock.github.util.Ae2Reflect; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.FluidStack; @@ -26,15 +31,30 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor { - public static FluidConvertingInventoryAdaptor wrap(ICapabilityProvider capProvider, EnumFacing face) { + public static InventoryAdaptor wrap(ICapabilityProvider capProvider, EnumFacing face) { // sometimes i wish i had the monadic version from 1.15 - return new FluidConvertingInventoryAdaptor( - capProvider.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face) - ? Objects.requireNonNull(capProvider.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face)) - : null, - capProvider.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face) - ? Objects.requireNonNull(capProvider.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face)) - : null); + TileEntity cap = (TileEntity) capProvider; + TileEntity inter = cap.getWorld().getTileEntity(cap.getPos().add(face.getDirectionVec())); + DualityInterface dualInterface = null; + if (inter instanceof IInterfaceHost) { + dualInterface = ((IInterfaceHost) inter).getInterfaceDuality(); + } else if (inter instanceof TileCableBus) { + IPart part = ((TileCableBus) inter).getPart(face.getOpposite()); + if (part instanceof IInterfaceHost) { + dualInterface = ((IInterfaceHost) part).getInterfaceDuality(); + } + } + + if (dualInterface != null && !Ae2Reflect.getFluidPacketMode(dualInterface)) { + return new FluidConvertingInventoryAdaptor( + capProvider.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face) + ? Objects.requireNonNull(capProvider.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face)) + : null, + capProvider.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face) + ? Objects.requireNonNull(capProvider.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face)) + : null); + } + return InventoryAdaptor.getAdaptor(cap, face); } @Nullable diff --git a/src/main/java/com/glodblock/github/inventory/GuiType.java b/src/main/java/com/glodblock/github/inventory/GuiType.java index 14446dfd1..f8efabe2e 100644 --- a/src/main/java/com/glodblock/github/inventory/GuiType.java +++ b/src/main/java/com/glodblock/github/inventory/GuiType.java @@ -7,7 +7,6 @@ import appeng.container.AEBaseContainer; import appeng.container.ContainerOpenContext; import appeng.container.implementations.ContainerCraftingStatus; -import appeng.container.implementations.ContainerInterface; import appeng.container.implementations.ContainerPriority; import appeng.fluids.container.ContainerFluidInterface; import appeng.fluids.helper.IFluidInterfaceHost; @@ -32,6 +31,18 @@ public enum GuiType { + ITEM_AMOUNT_SET(new PartOrTileGuiFactory(ITerminalHost.class) { + @Override + protected Object createServerGui(EntityPlayer player, ITerminalHost inv) { + return new ContainerItemAmountChange(player.inventory, inv); + } + + @Override + protected Object createClientGui(EntityPlayer player, ITerminalHost inv) { + return new GuiItemAmountChange(player.inventory, inv); + } + }), + FLUID_LEVEL_MAINTAINER(new PartOrTileGuiFactory(TileFluidLevelMaintainer.class) { @Override protected Object createServerGui(EntityPlayer player, TileFluidLevelMaintainer inv) { @@ -119,7 +130,7 @@ protected Object createClientGui(EntityPlayer player, TileBurette inv) { DUAL_ITEM_INTERFACE(new PartOrTileGuiFactory(IInterfaceHost.class) { @Override protected Object createServerGui(EntityPlayer player, IInterfaceHost inv) { - return new ContainerInterface(player.inventory, inv); + return new ContainerItemDualInterface(player.inventory, inv); } @Override diff --git a/src/main/java/com/glodblock/github/loader/ChannelLoader.java b/src/main/java/com/glodblock/github/loader/ChannelLoader.java index bc9de28cd..748e9c322 100644 --- a/src/main/java/com/glodblock/github/loader/ChannelLoader.java +++ b/src/main/java/com/glodblock/github/loader/ChannelLoader.java @@ -18,6 +18,8 @@ public void run() { FluidCraft.proxy.netHandler.registerMessage(new CPacketUpdateFluidLevel.Handler(), CPacketUpdateFluidLevel.class, id ++, Side.SERVER); FluidCraft.proxy.netHandler.registerMessage(new CPacketFluidPatternTermBtns.Handler(), CPacketFluidPatternTermBtns.class, id ++, Side.SERVER); FluidCraft.proxy.netHandler.registerMessage(new SPacketSetFluidLevel.Handler(), SPacketSetFluidLevel.class, id ++, Side.CLIENT); + FluidCraft.proxy.netHandler.registerMessage(new CPacketPatternValueSet.Handler(), CPacketPatternValueSet.class, id ++, Side.SERVER); + FluidCraft.proxy.netHandler.registerMessage(new CPacketInventoryAction.Handler(), CPacketInventoryAction.class, id ++, Side.SERVER); } } diff --git a/src/main/java/com/glodblock/github/network/CPacketFluidPatternTermBtns.java b/src/main/java/com/glodblock/github/network/CPacketFluidPatternTermBtns.java index af5ee8be9..633864317 100644 --- a/src/main/java/com/glodblock/github/network/CPacketFluidPatternTermBtns.java +++ b/src/main/java/com/glodblock/github/network/CPacketFluidPatternTermBtns.java @@ -2,6 +2,8 @@ import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal; import com.glodblock.github.client.container.ContainerFluidPatternTerminal; +import com.glodblock.github.client.container.ContainerItemDualInterface; +import com.glodblock.github.client.container.ContainerWrapInterface; import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal; import com.glodblock.github.common.part.PartFluidPatternTerminal; import io.netty.buffer.ByteBuf; @@ -67,6 +69,9 @@ public IMessage onMessage(CPacketFluidPatternTermBtns message, MessageContext ct case "PatternTerminal.Combine": ((PartFluidPatternTerminal) cpt.getPatternTerminal()).setCombineMode(Value.equals("1")); break; + case "PatternTerminal.Fluid": + ((PartFluidPatternTerminal) cpt.getPatternTerminal()).setFluidPlaceMode(Value.equals("1")); + break; } } else if (c instanceof ContainerExtendedFluidPatternTerminal) { final ContainerExtendedFluidPatternTerminal cpt = (ContainerExtendedFluidPatternTerminal) c; @@ -74,6 +79,23 @@ public IMessage onMessage(CPacketFluidPatternTermBtns message, MessageContext ct case "PatternTerminal.Combine": ((PartExtendedFluidPatternTerminal) cpt.getExpandedPatternTerminal()).setCombineMode(Value.equals("1")); break; + case "PatternTerminal.Fluid": + ((PartExtendedFluidPatternTerminal) cpt.getExpandedPatternTerminal()).setFluidPlaceMode(Value.equals("1")); + break; + } + } else if (c instanceof ContainerItemDualInterface) { + final ContainerItemDualInterface cdi = (ContainerItemDualInterface) c; + switch (Name) { + case "DualInterface.FluidPacket": + cdi.setFluidPacketInTile(Value.equals("1")); + break; + } + } else if (c instanceof ContainerWrapInterface) { + final ContainerWrapInterface cdi = (ContainerWrapInterface) c; + switch (Name) { + case "WrapDualInterface.FluidPacket": + cdi.setFluidPacketInTile(Value.equals("1")); + break; } } return null; diff --git a/src/main/java/com/glodblock/github/network/CPacketInventoryAction.java b/src/main/java/com/glodblock/github/network/CPacketInventoryAction.java new file mode 100644 index 000000000..de2986041 --- /dev/null +++ b/src/main/java/com/glodblock/github/network/CPacketInventoryAction.java @@ -0,0 +1,98 @@ +package com.glodblock.github.network; + +import appeng.api.storage.data.IAEItemStack; +import appeng.container.AEBaseContainer; +import appeng.container.ContainerOpenContext; +import appeng.util.item.AEItemStack; +import com.glodblock.github.client.container.ContainerItemAmountChange; +import com.glodblock.github.inventory.GuiType; +import com.glodblock.github.inventory.InventoryHandler; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +import javax.annotation.Nullable; +import java.io.IOException; + +public class CPacketInventoryAction implements IMessage { + + private int action; + private int slot; + private long id; + private IAEItemStack stack; + private boolean isEmpty; + + public CPacketInventoryAction() { + //NO-OP + } + + public CPacketInventoryAction( final int action, final int slot, final int id, IAEItemStack stack ) { + this.action = action; + this.slot = slot; + this.id = id; + this.stack = stack; + this.isEmpty = stack == null || stack.getDefinition().isEmpty(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(action); + buf.writeInt(slot); + buf.writeLong(id); + buf.writeBoolean(isEmpty); + if (!isEmpty) { + try { + stack.writeToPacket(buf); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + public void fromBytes(ByteBuf buf) { + action = buf.readInt(); + slot = buf.readInt(); + id = buf.readLong(); + isEmpty = buf.readBoolean(); + if (!isEmpty) { + stack = AEItemStack.fromPacket(buf); + } + } + + public static class Handler implements IMessageHandler { + @Nullable + @Override + public IMessage onMessage(CPacketInventoryAction message, MessageContext ctx) { + final EntityPlayerMP sender = ctx.getServerHandler().player; + if( sender.openContainer instanceof AEBaseContainer) { + final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer; + if (message.action == 1) + { + final ContainerOpenContext context = baseContainer.getOpenContext(); + if( context != null ) + { + final TileEntity te = context.getTile(); + InventoryHandler.openGui( sender, te.getWorld(), te.getPos(), baseContainer.getOpenContext().getSide().getFacing(), GuiType.ITEM_AMOUNT_SET ); + if( sender.openContainer instanceof ContainerItemAmountChange) + { + final ContainerItemAmountChange iac = (ContainerItemAmountChange) sender.openContainer; + if( message.stack != null ) + { + iac.getPatternValue().putStack( message.stack.getDefinition() ); + iac.setValueIndex( message.slot ); + iac.setInitValue( message.stack.getStackSize() ); + } + iac.detectAndSendChanges(); + } + } + } + } + return null; + } + } + +} diff --git a/src/main/java/com/glodblock/github/network/CPacketPatternValueSet.java b/src/main/java/com/glodblock/github/network/CPacketPatternValueSet.java new file mode 100644 index 000000000..3e25a49bc --- /dev/null +++ b/src/main/java/com/glodblock/github/network/CPacketPatternValueSet.java @@ -0,0 +1,87 @@ +package com.glodblock.github.network; + +import appeng.api.networking.IGridHost; +import appeng.container.ContainerOpenContext; +import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal; +import com.glodblock.github.client.container.ContainerFluidPatternTerminal; +import com.glodblock.github.client.container.ContainerItemAmountChange; +import com.glodblock.github.common.item.ItemFluidPacket; +import com.glodblock.github.inventory.GuiType; +import com.glodblock.github.inventory.InventoryHandler; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +public class CPacketPatternValueSet implements IMessage { + + private GuiType originGui; + private int amount; + private int valueIndex; + + public CPacketPatternValueSet() { + //NO-OP + } + + public CPacketPatternValueSet( GuiType originalGui, int amount, int valueIndex ){ + this.originGui = originalGui; + this.amount = amount; + this.valueIndex = valueIndex; + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(originGui.ordinal()); + buf.writeInt(amount); + buf.writeInt(valueIndex); + } + + @Override + public void fromBytes(ByteBuf buf) { + this.originGui = GuiType.getByOrdinal(buf.readInt()); + this.amount = buf.readInt(); + this.valueIndex = buf.readInt(); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(CPacketPatternValueSet message, MessageContext ctx) { + EntityPlayer player = ctx.getServerHandler().player; + if (player.openContainer instanceof ContainerItemAmountChange) { + ContainerItemAmountChange cpv = (ContainerItemAmountChange) player.openContainer; + final Object target = cpv.getTarget(); + if (target instanceof IGridHost) { + final ContainerOpenContext context = cpv.getOpenContext(); + if (context != null) { + final TileEntity te = context.getTile(); + InventoryHandler.openGui(player, player.world, te.getPos(), context.getSide().getFacing(), message.originGui); + if (player.openContainer instanceof ContainerFluidPatternTerminal || player.openContainer instanceof ContainerExtendedFluidPatternTerminal) { + Slot slot = player.openContainer.getSlot(message.valueIndex); + if (slot.getHasStack()) { + ItemStack stack = slot.getStack().copy(); + if (stack.getItem() instanceof ItemFluidPacket) { + FluidStack fluidStack = ItemFluidPacket.getFluidStack(stack); + if (fluidStack != null) { + fluidStack.amount = message.amount; + } + slot.putStack(ItemFluidPacket.newStack(fluidStack)); + } else { + stack.setCount(message.amount); + slot.putStack(stack); + } + } + } + } + } + } + return null; + } + + } +} diff --git a/src/main/java/com/glodblock/github/proxy/CommonProxy.java b/src/main/java/com/glodblock/github/proxy/CommonProxy.java index cc750eeca..7e0261c8d 100644 --- a/src/main/java/com/glodblock/github/proxy/CommonProxy.java +++ b/src/main/java/com/glodblock/github/proxy/CommonProxy.java @@ -20,7 +20,6 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -28,7 +27,6 @@ import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; import java.util.Objects; diff --git a/src/main/java/com/glodblock/github/util/Ae2Reflect.java b/src/main/java/com/glodblock/github/util/Ae2Reflect.java index 2483d991c..5871ee0cc 100644 --- a/src/main/java/com/glodblock/github/util/Ae2Reflect.java +++ b/src/main/java/com/glodblock/github/util/Ae2Reflect.java @@ -10,9 +10,15 @@ import appeng.container.slot.SlotFakeCraftingMatrix; import appeng.container.slot.SlotRestrictedInput; import appeng.crafting.MECraftingInventory; +import appeng.helpers.DualityInterface; import appeng.me.cluster.implementations.CraftingCPUCluster; +import appeng.parts.reporting.PartExpandedProcessingPatternTerminal; +import appeng.parts.reporting.PartPatternTerminal; import appeng.recipes.game.DisassembleRecipe; +import appeng.tile.inventory.AppEngInternalInventory; import appeng.util.inv.ItemSlot; +import appeng.util.inv.filter.IAEItemFilter; +import com.glodblock.github.inventory.ExAppEngInternalInventory; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; @@ -39,6 +45,12 @@ public class Ae2Reflect { private static final Field fInventory_container; private static final Field fCPU_inventory; private static final Field fCPU_machineSrc; + private static final Field fDualInterface_fluidPacket; + private static final Field fAppEngInternalInventory_filter; + private static final Field fPartExpanded_crafting; + private static final Field fPartExpanded_output; + private static final Field fPart_crafting; + private static final Field fPart_output; static { try { @@ -58,6 +70,12 @@ public class Ae2Reflect { fContainerExPatternTerm_patternSlotOUT = reflectField(ContainerExpandedProcessingPatternTerm.class, "patternSlotOUT"); fCPU_inventory = Ae2Reflect.reflectField(CraftingCPUCluster.class, "inventory"); fCPU_machineSrc = Ae2Reflect.reflectField(CraftingCPUCluster.class, "machineSrc"); + fDualInterface_fluidPacket = Ae2Reflect.reflectField(DualityInterface.class, "fluidPacket"); + fAppEngInternalInventory_filter = Ae2Reflect.reflectField(AppEngInternalInventory.class, "filter"); + fPartExpanded_crafting = Ae2Reflect.reflectField(PartExpandedProcessingPatternTerminal.class, "crafting"); + fPartExpanded_output = Ae2Reflect.reflectField(PartExpandedProcessingPatternTerminal.class, "output"); + fPart_crafting = Ae2Reflect.reflectField(PartPatternTerminal.class, "crafting"); + fPart_output = Ae2Reflect.reflectField(PartPatternTerminal.class, "output"); } catch (Exception e) { throw new IllegalStateException("Failed to initialize AE2 reflection hacks!", e); } @@ -185,4 +203,25 @@ public static void markCPUDirty(CraftingCPUCluster cpu) { } } + public static boolean getFluidPacketMode(DualityInterface owner) { + return readField(owner, fDualInterface_fluidPacket); + } + + public static void setFluidPacketMode(DualityInterface owner, boolean value) { + writeField(owner, fDualInterface_fluidPacket, value); + } + + public static IAEItemFilter getInventoryFilter(AppEngInternalInventory owner) { + return readField(owner, fAppEngInternalInventory_filter); + } + + public static void setInventoryForPart(PartExpandedProcessingPatternTerminal part, ExAppEngInternalInventory craft, ExAppEngInternalInventory output) { + writeField(part, fPartExpanded_crafting, craft); + writeField(part, fPartExpanded_output, output); + } + + public static void setInventoryForPart(PartPatternTerminal part, ExAppEngInternalInventory craft, ExAppEngInternalInventory output) { + writeField(part, fPart_crafting, craft); + writeField(part, fPart_output, output); + } } \ No newline at end of file diff --git a/src/main/java/com/glodblock/github/util/Ae2ReflectClient.java b/src/main/java/com/glodblock/github/util/Ae2ReflectClient.java index 9388858a9..1f4bd9cfc 100644 --- a/src/main/java/com/glodblock/github/util/Ae2ReflectClient.java +++ b/src/main/java/com/glodblock/github/util/Ae2ReflectClient.java @@ -2,22 +2,27 @@ import appeng.client.gui.AEBaseGui; import appeng.client.gui.implementations.*; +import appeng.client.gui.widgets.GuiNumberBox; import appeng.client.gui.widgets.GuiTabButton; import appeng.client.render.StackSizeRenderer; +import appeng.container.implementations.ContainerUpgradeable; import appeng.fluids.client.gui.GuiFluidInterface; import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal; import com.glodblock.github.client.container.ContainerFluidPatternTerminal; import com.google.common.collect.ImmutableMap; +import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraftforge.common.model.TRSRTransformation; import java.lang.reflect.Constructor; import java.lang.reflect.Field; +import java.lang.reflect.Method; @SuppressWarnings("unchecked") public class Ae2ReflectClient { + private static final Method mGuiCraftAmount_addQty; private static final Field fAEBaseGui_stackSizeRenderer; private static final Constructor cItemEncodedPatternBakedModel; private static final Field fGuiPriority_originalGuiBtn; @@ -28,9 +33,16 @@ public class Ae2ReflectClient { private static final Field fGuiMEMonitorable_craftingStatusBtn; private static final Field fGuiInterface_priority; private static final Field fGuiFluidInterface_priority; + private static final Field fGuiUpgradeable_cvb; + private static final Field fGuiCraftAmount_next; + private static final Field fGuiCraftAmount_amountToCraft; + private static final Field fGuiCraftAmount_originalGuiBtn; + private static final Field[] fGuiCraftAmount_minus = new Field[4]; + private static final Field[] fGuiCraftAmount_plus = new Field[4]; static { try { + mGuiCraftAmount_addQty = Ae2Reflect.reflectMethod(GuiCraftAmount.class, "addQty", int.class); fAEBaseGui_stackSizeRenderer = Ae2Reflect.reflectField(AEBaseGui.class, "stackSizeRenderer"); cItemEncodedPatternBakedModel = (Constructor)Class .forName("appeng.client.render.crafting.ItemEncodedPatternBakedModel") @@ -44,6 +56,14 @@ public class Ae2ReflectClient { fGuiMEMonitorable_craftingStatusBtn = Ae2Reflect.reflectField(GuiMEMonitorable.class, "craftingStatusBtn"); fGuiInterface_priority = Ae2Reflect.reflectField(GuiInterface.class, "priority"); fGuiFluidInterface_priority = Ae2Reflect.reflectField(GuiFluidInterface.class, "priority"); + fGuiUpgradeable_cvb = Ae2Reflect.reflectField(GuiUpgradeable.class, "cvb"); + fGuiCraftAmount_next = Ae2Reflect.reflectField(GuiCraftAmount.class, "next"); + fGuiCraftAmount_amountToCraft = Ae2Reflect.reflectField(GuiCraftAmount.class, "amountToCraft"); + fGuiCraftAmount_originalGuiBtn = Ae2Reflect.reflectField(GuiCraftAmount.class, "originalGuiBtn"); + for (int i = 1, j = 0; i <= 1000; i *= 10, j ++) { + fGuiCraftAmount_minus[j] = Ae2Reflect.reflectField(GuiCraftAmount.class, "minus" + i); + fGuiCraftAmount_plus[j] = Ae2Reflect.reflectField(GuiCraftAmount.class, "plus" + i); + } } catch (Exception e) { throw new IllegalStateException("Failed to initialize AE2 reflection hacks!", e); } @@ -93,4 +113,34 @@ public static GuiTabButton getPriorityButton(GuiFluidInterface gui) { return Ae2Reflect.readField(gui, fGuiFluidInterface_priority); } + public static void setInterfaceContainer(GuiUpgradeable instance, ContainerUpgradeable container) { + Ae2Reflect.writeField(instance, fGuiUpgradeable_cvb, container); + } + + public static GuiButton getGuiCraftAmountNextButton(GuiCraftAmount gui) { + return Ae2Reflect.readField(gui, fGuiCraftAmount_next); + } + + public static GuiNumberBox getGuiCraftAmountTextBox(GuiCraftAmount gui) { + return Ae2Reflect.readField(gui, fGuiCraftAmount_amountToCraft); + } + + public static GuiButton getGuiCraftAmountAddButton(GuiCraftAmount gui, int index) { + return index < 0 ? + Ae2Reflect.readField(gui, fGuiCraftAmount_minus[-index - 1]) : + Ae2Reflect.readField(gui, fGuiCraftAmount_plus[index - 1]); + } + + public static void setGuiCraftAmountAddQty(GuiCraftAmount gui, int amount) { + try { + mGuiCraftAmount_addQty.invoke(gui, amount); + } catch (Exception e) { + throw new IllegalStateException("Failed to invoke method: " + mGuiCraftAmount_addQty, e); + } + } + + public static GuiTabButton getGuiCraftAmountBackButton(GuiCraftAmount gui) { + return Ae2Reflect.readField(gui, fGuiCraftAmount_originalGuiBtn); + } + } diff --git a/src/main/java/com/glodblock/github/util/NameConst.java b/src/main/java/com/glodblock/github/util/NameConst.java index 73d46bd5f..8d8cf5f61 100644 --- a/src/main/java/com/glodblock/github/util/NameConst.java +++ b/src/main/java/com/glodblock/github/util/NameConst.java @@ -39,6 +39,8 @@ public final class NameConst { public static final String GUI_LARGE_INGREDIENT_BUFFER = GUI_KEY + BLOCK_LARGE_INGREDIENT_BUFFER; public static final String GUI_BURETTE = GUI_KEY + BLOCK_BURETTE; public static final String GUI_FLUID_LEVEL_MAINTAINER = GUI_KEY + BLOCK_FLUID_LEVEL_MAINTAINER; + public static final String GUI_ITEM_AMOUNT_SET = GUI_KEY + "item_amount_set"; + public static final String GUI_ITEM_AMOUNT_SET_CONFIRM = GUI_KEY + "set"; public static final String MISC = FluidCraft.MODID + ".misc."; public static final String MISC_THRESHOLD = MISC + "threshold"; diff --git a/src/main/resources/assets/ae2fc/lang/en_us.lang b/src/main/resources/assets/ae2fc/lang/en_us.lang index 97632c254..deb0cec2c 100644 --- a/src/main/resources/assets/ae2fc/lang/en_us.lang +++ b/src/main/resources/assets/ae2fc/lang/en_us.lang @@ -23,6 +23,8 @@ ae2fc.gui.ingredient_buffer=Ingredient Buffer ae2fc.gui.large_ingredient_buffer=Large Ingredient Buffer ae2fc.gui.burette=Precision Burette ae2fc.gui.fluid_level_maintainer=ME Fluid Level Maintainer +ae2fc.gui.item_amount_set=Set Amount +ae2fc.gui.set=Set ae2fc.misc.threshold=Threshold ae2fc.misc.request=Batch Size @@ -40,6 +42,14 @@ ae2fc.tooltip.not_combine=Merge the same items ae2fc.tooltip.not_combine.hint=Disabled ae2fc.tooltip.combine=Merge the same items ae2fc.tooltip.combine.hint=Enabled +ae2fc.tooltip.real_fluid=Send Real Fluid +ae2fc.tooltip.real_fluid.hint=The real fluid will be sent to target container +ae2fc.tooltip.fake_packet=Send Fluid Packet +ae2fc.tooltip.fake_packet.hint=The fluid packet item will be sent to target container +ae2fc.tooltip.fluid_first=Place Fluid First In Pattern +ae2fc.tooltip.fluid_first.hint=Enable +ae2fc.tooltip.origin_order=Place Fluid First In Pattern +ae2fc.tooltip.origin_order.hint=Disabled ae2fc.pauto.fluid_processing.name=Fluid Processing ae2fc.pauto.fluid_processing.name_short=Fluid diff --git a/src/main/resources/assets/ae2fc/models/item/fluid_packet.json b/src/main/resources/assets/ae2fc/models/item/fluid_packet.json index 134d55d6f..74c1e42e3 100644 --- a/src/main/resources/assets/ae2fc/models/item/fluid_packet.json +++ b/src/main/resources/assets/ae2fc/models/item/fluid_packet.json @@ -1,7 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "ae2fc:items/fluid_packet", - "layer1": "ae2fc:items/fluid_packet_overlay" + "layer0": "ae2fc:items/fluid_packet" } } diff --git a/src/main/resources/assets/ae2fc/textures/gui/states.png b/src/main/resources/assets/ae2fc/textures/gui/states.png index ce994c2e4ca9f9e28577d4f399f7f46cc3aa087b..4f3f569551a7f3ea47d4ba1b555faff33e850fba 100644 GIT binary patch delta 1639 zcmV-t2AKKY1@{b)BYy@yNklH`TjF7c_ReQRRc2OccMswpO#nrNfQrsdJ#T1+53$ZEu-iV$pR(;A`H z#O|WN{!DY`-no1KcK6C+S-<4w-kCe+&iBnZXXY$0&N-Z*v462q3=D_E%#nc!`Pyef zk&{UYZEbB@pHmX~+B<>81LjFvT3RqZKCZnV9UaBVlP5E-*~zxIt)t5#|K zeSLk}Ajw+@u$z>ipI8qwiG1y)07<;+jnClmlo)Kh-b(y)^N1!y6A%alcyn_zg2A9R zIMc+34<9zPuYX;;hKh;`)Kd?a%WW9zDe+*#%HPEEjs7n* zJCOr4d3Sd=wr}5_b<$0nHdzQPg+0_z`SaHkm|OoniUFijNsEYEGiwmPzRS?3B{5At zFfbtQ*(N1SPEK0-^0gK?;#5ezRA7I%?<_0(yIum(|tPStow<=#jzg68YMj;q&?6t-pZQ+DqD-BR>P5 zY`y^VItT%SgM(;jXu!n8gk@3!xhxWi&@O@2)>hHi-rg?SPVFV6J>k@;Q`)n-Me>f0 z4$=Ph(|`LI9knio%0=6~gn)23Ok1HKVK*s}zg<>_nn*+tAo8*u2n2H4>q$!@U0q$; z0+>M|NnU`ugl(QJ{&)OT#&!D@t&Ap zJCM|qxT&d03nRS;poW|bAInKBNhFg=M59rIN|^(ayu3TLmn%-B_2dmibOIC#f0fq25T(`u8c*Lm2U+25D=NS7G_&2r@(e7V{@a4@4EaIaN=_S?>NdM=5pbWS>^gS z^&CD9c3{i9LEL@J5nBMFiDEEjOxtt_tx!EN=Eq1~1pEpRsjC*N4_!Tub?LFWuzzdy zN--kjY`8c>B6noCEMV={IZRJaYkf(cz~lJ^s{l$`O4#u)Z-c6Fs_uOUYcvtHcl=sC zexUp)Is;vbO~#~FS6>woA}{QX?KVo4;Eq@B zgVjNZ7+I%;3{`|qLByp89K+?tN`G&$xLzoYqj;(ZKGz7IFK6PS{*);gg#cPfeo0w% z3984>f6$|e7>=$Hg<0ox7ies*Ej2VXW4JrTLOh{(V?`W_!A>Zkd_QzbhS6`2x zM-N)CTZrha@3M@wM;{Aqo8=!}?nG$v9HIPki8=9*lttGifTn#gO9jh{uiR zfS62wQ9Yh215dpO&UY&pJ%3XlmAU5e%YE5aqjb^&=>x0oHRY#cw$pdH@XVLfMPQ+2 zRdDyOEsM52d-klF!~;3U+C%;+G*5dXk`0MO0!2mE%D=zAKl=}wck$WhdB1i? z%lCbdLAhKeUvyp9k|G2U%D0~641^#hBZ{ck>+G6r64LxxOn>(!K>|V1YPAZR%?9{u zQAw!suLT()ktl)}=CN9>U^pDIaZuvp2q|>HvTfV1R4UMHHre$s;cmD4Dqb#^kWQyT zg}?AVtB(+h_xpV)l}eGK`F#Guz%BSHU^{@~v)PP%Mu{S}+wEmB6!~#M5}+;5WHKyb zQUFzu4)l6Ga+`L$4ZGb=D9TJfKeJET0U16&N@)J$w}1EW{nH=t!BOe}Nq|-kXL!9{ zLpGZY73R%*o+r&mZllqF!C=75lNTvCYA-VSCYITOUeATveM^E*I6?C_O@Nx9GrU+Vn22Sai^U1k_zM2TJqTCvIQ=q%cZ`>#ghC5- z^WWWb^?wmb0=khTpc_d7x{)NH8%YAXktCoS|H*M$BYyvSj4eJMkInc!fJUNlJRTvH zx~%ndIyG|#(6H!#5sXVfRBalIlF_~c6x3XldC?dd)d7(~5LBLzjY)tvj|PLL!^X(S z9e|M05sjIVPob!}$C&SeF-uIr8w^`$9!7K^YCz^i-!*cCcvG@ZBQPZa8N;Dt^^d*9 t!rkqF2r}jo+J6sx{qmEXDq{fv{sJ`R4N(n>Z3X}U002ovPDHLkV1ix#PniG! diff --git a/src/main/resources/assets/ae2fc/textures/items/fluid_packet.png b/src/main/resources/assets/ae2fc/textures/items/fluid_packet.png index bb301cdbe18243826576c2e1da123d6b83b34a41..9b745b1ecf3f4bd1a79fe18f539153b6efb3f96c 100644 GIT binary patch delta 226 zcmV<803H9i2K@n$BYyzINklvhWm~!22IU7i>vP+!#e( z4cIotmJ;f}n;5|4rs)8Dgb=6%AcTa;UqI;;eu4<_8OITZ zVfcB_HxfcX-}j-uy?@kNXFDSl-!uZMs>%XQ)1(2VR2JB_En5vZmtTpxuG7HfE1dOj zvDT)6Wm&SoJkL=b?E%IZx~>aP)wXTuW{e5-zV9HV{FpKVIOo|3&I!O{E!}gwiUI#u c{S^SX1BjYJ;s`LXvj6}907*qoM6N<$g3jP(od5s; delta 803 zcmV+;1Kj-m0l5Z{BYy#fX+uL$Nkc;*aB^>EX>4Tx04R}tkv&MmKpe$iTT4YM4p#6B z%ut;yh>AE$6^me@v=v%)FuC*#nlvOSE{=k0!NHHks)LKOt`4q(Aou~|}?mh0_0p5CNrw>4yx>~*g4i15_0%fneynnm1y|;hQH2eDjn$dE%I-%s* z00006VoOIv0RI600RN!9r;`8x010qNS#tmYE+YT{E+YYWr9XB6000McNlirueSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{009t5L_t(I z%hi)Ha(@Cb3`L)0n+47Q4ITHt3&3^xFFv1Fwon=r|yp^7@Gc>jOdl8E4)Qr@h$ z0r`8g-|wllQfr-NW=7X_xI4ozP)gx^KK~A=wGt7bs)z^x5rOKL(Z}NAyMNR7Jq(ReE{8k($002ovPDHLkV1l9WYmEQ^ diff --git a/src/main/resources/assets/ae2fc/textures/items/fluid_packet_overlay.png b/src/main/resources/assets/ae2fc/textures/items/fluid_packet_overlay.png deleted file mode 100644 index 6610c0fe59341646ad82bbee8e86680047ca703e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 618 zcmV-w0+s!VP)EX>4Tx04R}tkv&MmKpe$iTT4YM4p#6B%ut;yh>AE$6^me@v=v%)FuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|}?mh0_0p5CFSdOA5z93mD9Z7j7hE9wgIG;vr~RLb{e z9F{q6aaPJz*1RWwVKAqzq_|FV7%?m%jsyfqsG@{2Ohjl^NimS5{iut7(DoAO zrG<}xo^9abx}`~bz~v6m|D=h!XiGkt-h3W-KcjET0=>6D*P7E?b04PqKZ*#H0l24YJ`L;(K){{a7>y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2jm4G6(AL3FPdKf000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0000%Nkl}#P_x&QzG07*qoM6N<$ Ef?_TDPyhe`