Merge pull request #18 from asdflj/master

me dual interface add insert mode
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-09-22 17:25:49 +02:00
commit 292a70ab6e
2 files changed
+25 -4

No files matched your search

@@ -1,5 +1,6 @@
package com.glodblock.github.client.gui;
import appeng.api.config.InsertionMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.implementations.GuiUpgradeable;
@@ -30,6 +31,7 @@ public class GuiDualInterface extends GuiUpgradeable {
private GuiTabButton switcher;
private GuiImgButton BlockMode;
private GuiToggleButton interfaceMode;
private GuiImgButton insertionMode;
private final IInterfaceHost host;
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
@@ -53,6 +55,9 @@ public class GuiDualInterface extends GuiUpgradeable {
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode );
this.insertionMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT );
this.buttonList.add( this.insertionMode );
}
@Override
@@ -67,6 +72,10 @@ public class GuiDualInterface extends GuiUpgradeable {
{
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES );
}
if( this.insertionMode != null )
{
this.insertionMode.set( ( (ContainerInterface) this.cvb ).getInsertionMode());
}
this.fontRendererObj.drawString( getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752 );
}
@@ -124,5 +133,9 @@ public class GuiDualInterface extends GuiUpgradeable {
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
if( btn == this.insertionMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.insertionMode.getSetting(), backwards ) );
}
}
}
@@ -1,6 +1,7 @@
package com.glodblock.github.inventory;
import appeng.api.config.FuzzyMode;
import appeng.api.config.InsertionMode;
import appeng.tile.networking.TileCableBus;
import appeng.util.InventoryAdaptor;
import appeng.util.inv.IInventoryDestination;
@@ -46,8 +47,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
this.side = Util.from(facing);
}
@Override
public ItemStack addItems(ItemStack toBeAdded) {
public ItemStack addItems( ItemStack toBeAdded,InsertionMode insertionMode ) {
if (toBeAdded.getItem() instanceof ItemFluidPacket) {
if (invFluids != null) {
FluidStack fluid = ItemFluidPacket.getFluidStack(toBeAdded);
@@ -61,11 +61,19 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
return toBeAdded;
}
return invItems != null ? invItems.addItems(toBeAdded) : toBeAdded;
return invItems != null ? invItems.addItems(toBeAdded,insertionMode) : toBeAdded;
}
@Override
public ItemStack addItems(ItemStack toBeAdded) {
return addItems(toBeAdded,InsertionMode.DEFAULT);
}
@Override
public ItemStack simulateAdd(ItemStack toBeSimulated) {
return simulateAdd(toBeSimulated,InsertionMode.DEFAULT);
}
@Override
public ItemStack simulateAdd(ItemStack toBeSimulated,InsertionMode insertionMode) {
if (toBeSimulated.getItem() instanceof ItemFluidPacket) {
if (invFluids != null) {
FluidStack fluid = ItemFluidPacket.getFluidStack(toBeSimulated);
@@ -79,7 +87,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
return toBeSimulated;
}
return invItems != null ? invItems.simulateAdd(toBeSimulated) : toBeSimulated;
return invItems != null ? invItems.simulateAdd(toBeSimulated,insertionMode) : toBeSimulated;
}
@Override