Skip to content

Commit

Permalink
Merge pull request #18 from asdflj/master
Browse files Browse the repository at this point in the history
me dual interface add insert mode
  • Loading branch information
Dream-Master authored Sep 22, 2022
2 parents a575e58 + 2b8c983 commit 292a70a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -53,6 +55,9 @@ protected void addButtons()

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
Expand All @@ -67,6 +72,10 @@ public void drawFG( final int offsetX, final int offsetY, final int mouseX, fina
{
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 );
}
Expand Down Expand Up @@ -124,5 +133,9 @@ else if (host instanceof PartFluidInterface) {
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
if( btn == this.insertionMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.insertionMode.getSetting(), backwards ) );
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -46,8 +47,7 @@ public FluidConvertingInventoryAdaptor(@Nullable InventoryAdaptor invItems, @Nul
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);
Expand All @@ -61,11 +61,19 @@ public ItemStack addItems(ItemStack toBeAdded) {
}
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);
Expand All @@ -79,7 +87,7 @@ public ItemStack simulateAdd(ItemStack toBeSimulated) {
}
return toBeSimulated;
}
return invItems != null ? invItems.simulateAdd(toBeSimulated) : toBeSimulated;
return invItems != null ? invItems.simulateAdd(toBeSimulated,insertionMode) : toBeSimulated;
}

@Override
Expand Down

0 comments on commit 292a70a

Please sign in to comment.