2014-01-24 17:35:58 +01:00
|
|
|
package appeng.client.gui.implementations;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
|
|
|
|
import org.lwjgl.input.Mouse;
|
|
|
|
|
|
|
|
import appeng.api.config.AccessRestriction;
|
|
|
|
import appeng.api.config.FuzzyMode;
|
|
|
|
import appeng.api.config.Settings;
|
|
|
|
import appeng.client.gui.widgets.GuiImgButton;
|
2014-01-26 07:44:50 +01:00
|
|
|
import appeng.client.gui.widgets.GuiTabButton;
|
2014-01-24 17:35:58 +01:00
|
|
|
import appeng.container.implementations.ContainerStorageBus;
|
2014-02-07 21:37:22 +01:00
|
|
|
import appeng.core.AELog;
|
2014-01-24 17:35:58 +01:00
|
|
|
import appeng.core.localization.GuiText;
|
2014-01-26 07:44:50 +01:00
|
|
|
import appeng.core.sync.GuiBridge;
|
2014-02-09 02:34:52 +01:00
|
|
|
import appeng.core.sync.network.NetworkHandler;
|
2014-01-24 17:35:58 +01:00
|
|
|
import appeng.core.sync.packets.PacketConfigButton;
|
2014-01-26 07:44:50 +01:00
|
|
|
import appeng.core.sync.packets.PacketSwitchGuis;
|
2014-01-24 17:35:58 +01:00
|
|
|
import appeng.parts.misc.PartStorageBus;
|
|
|
|
|
|
|
|
public class GuiStorageBus extends GuiUpgradeable
|
|
|
|
{
|
|
|
|
|
|
|
|
GuiImgButton rwMode;
|
2014-01-26 07:44:50 +01:00
|
|
|
GuiTabButton priority;
|
2014-01-24 17:35:58 +01:00
|
|
|
|
|
|
|
public GuiStorageBus(InventoryPlayer inventoryPlayer, PartStorageBus te) {
|
|
|
|
super( new ContainerStorageBus( inventoryPlayer, te ) );
|
2014-01-26 07:44:50 +01:00
|
|
|
this.ySize = 251;
|
2014-01-24 17:35:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
|
|
|
{
|
|
|
|
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
fontRendererObj.drawString( GuiText.StorageBus.getLocal(), 8, 6, 4210752 );
|
|
|
|
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
2014-01-24 17:35:58 +01:00
|
|
|
|
|
|
|
if ( fuzzyMode != null )
|
|
|
|
fuzzyMode.set( cvb.fzMode );
|
|
|
|
|
|
|
|
if ( rwMode != null )
|
|
|
|
rwMode.set( ((ContainerStorageBus) cvb).rwMode );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void addButtons()
|
|
|
|
{
|
|
|
|
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
|
|
|
rwMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACCESS, AccessRestriction.READ_WRITE );
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
2014-01-26 07:44:50 +01:00
|
|
|
|
2014-01-24 17:35:58 +01:00
|
|
|
buttonList.add( fuzzyMode );
|
|
|
|
buttonList.add( rwMode );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void actionPerformed(GuiButton btn)
|
|
|
|
{
|
|
|
|
super.actionPerformed( btn );
|
|
|
|
|
|
|
|
boolean backwards = Mouse.isButtonDown( 1 );
|
|
|
|
|
2014-01-26 07:44:50 +01:00
|
|
|
if ( btn == priority )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
2014-01-26 07:44:50 +01:00
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2014-01-26 07:44:50 +01:00
|
|
|
}
|
|
|
|
}
|
2014-01-24 17:35:58 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( btn == fuzzyMode )
|
2014-02-09 02:34:52 +01:00
|
|
|
NetworkHandler.instance.sendToServer( new PacketConfigButton( fuzzyMode.getSetting(), backwards ) );
|
2014-01-24 17:35:58 +01:00
|
|
|
|
|
|
|
if ( btn == rwMode )
|
2014-02-09 02:34:52 +01:00
|
|
|
NetworkHandler.instance.sendToServer( new PacketConfigButton( rwMode.getSetting(), backwards ) );
|
2014-01-24 17:35:58 +01:00
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2014-01-24 17:35:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected String getBackground()
|
|
|
|
{
|
|
|
|
return "guis/storagebus.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|