mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
Add SidelessMode button to FluidInterface
This commit is contained in:
1 parent
18b67f804b
commit
05485ddaa6
4 files changed
+52
-2
No files matched your search
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
@@ -13,6 +14,7 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerDualInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
@@ -32,10 +34,11 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
private GuiImgButton BlockMode;
|
||||
private GuiToggleButton interfaceMode;
|
||||
private GuiImgButton insertionMode;
|
||||
private GuiImgButton sidelessMode;
|
||||
private final IInterfaceHost host;
|
||||
|
||||
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
|
||||
super(new ContainerInterface(inventoryPlayer, te));
|
||||
super(new ContainerDualInterface(inventoryPlayer, te));
|
||||
this.host = te;
|
||||
this.ySize = 211;
|
||||
}
|
||||
@@ -58,6 +61,9 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
|
||||
this.insertionMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT );
|
||||
this.buttonList.add( this.insertionMode );
|
||||
|
||||
this.sidelessMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 62, Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
this.buttonList.add( this.sidelessMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +82,9 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
{
|
||||
this.insertionMode.set( ( (ContainerInterface) this.cvb ).getInsertionMode());
|
||||
}
|
||||
if (this.sidelessMode != null) {
|
||||
this.sidelessMode.set( ( (ContainerDualInterface) this.cvb ).getSidelessMode());
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString( getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752 );
|
||||
}
|
||||
@@ -137,5 +146,9 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.insertionMode.getSetting(), backwards ) );
|
||||
}
|
||||
if (btn == this.sidelessMode)
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.sidelessMode.getSetting(), backwards ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerDualInterface extends ContainerInterface {
|
||||
|
||||
@GuiSync(10)
|
||||
public SidelessMode sidelessMode;
|
||||
|
||||
public ContainerDualInterface(InventoryPlayer ip, IInterfaceHost te) {
|
||||
super(ip, te);
|
||||
this.sidelessMode = SidelessMode.SIDELESS;
|
||||
}
|
||||
|
||||
public SidelessMode getSidelessMode() {
|
||||
return this.sidelessMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
this.sidelessMode = (SidelessMode) cm.getSetting(Settings.SIDELESS_MODE);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -35,6 +37,11 @@ import java.io.IOException;
|
||||
public class TileFluidInterface extends TileInterface implements IFluidHandler, IAEFluidInventory
|
||||
{
|
||||
|
||||
public TileFluidInterface() {
|
||||
super.getInterfaceDuality().getConfigManager()
|
||||
.registerSetting(Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
}
|
||||
|
||||
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this) {
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
|
||||
@@ -69,7 +69,7 @@ public enum GuiType {
|
||||
DUAL_INTERFACE(new TileGuiFactory<TileFluidInterface>(TileFluidInterface.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidInterface inv) {
|
||||
return new ContainerInterface(player.inventory, inv);
|
||||
return new ContainerDualInterface(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user