2014-02-05 03:44:54 +01:00
|
|
|
package appeng.client.gui.implementations;
|
|
|
|
|
2014-02-27 05:47:06 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
2014-02-05 03:44:54 +01:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
2014-02-27 05:47:06 +01:00
|
|
|
import net.minecraft.inventory.Container;
|
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
import appeng.api.config.ActionItems;
|
|
|
|
import appeng.api.config.Settings;
|
2014-02-17 01:50:25 +01:00
|
|
|
import appeng.api.storage.ITerminalHost;
|
2014-02-27 05:47:06 +01:00
|
|
|
import appeng.client.gui.widgets.GuiImgButton;
|
2014-02-05 03:44:54 +01:00
|
|
|
import appeng.container.implementations.ContainerCraftingTerm;
|
2014-02-27 05:47:06 +01:00
|
|
|
import appeng.container.slot.SlotCraftingMatrix;
|
|
|
|
import appeng.core.AELog;
|
2014-02-05 03:44:54 +01:00
|
|
|
import appeng.core.localization.GuiText;
|
2014-02-27 05:47:06 +01:00
|
|
|
import appeng.core.sync.network.NetworkHandler;
|
|
|
|
import appeng.core.sync.packets.PacketInventoryAction;
|
|
|
|
import appeng.helpers.InventoryAction;
|
2014-02-05 03:44:54 +01:00
|
|
|
|
|
|
|
public class GuiCraftingTerm extends GuiMEMonitorable
|
|
|
|
{
|
|
|
|
|
2014-02-27 05:47:06 +01:00
|
|
|
GuiImgButton clearBtn;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initGui()
|
|
|
|
{
|
|
|
|
super.initGui();
|
|
|
|
buttonList.add( clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.CLOSE ) );
|
|
|
|
clearBtn.halfSize = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void actionPerformed(GuiButton btn)
|
|
|
|
{
|
|
|
|
super.actionPerformed( btn );
|
|
|
|
|
|
|
|
if ( clearBtn == btn )
|
|
|
|
{
|
|
|
|
Slot s = null;
|
|
|
|
Container c = inventorySlots;
|
|
|
|
for (Object j : c.inventorySlots)
|
|
|
|
{
|
|
|
|
if ( j instanceof SlotCraftingMatrix )
|
|
|
|
s = (Slot) j;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( s != null )
|
|
|
|
{
|
|
|
|
PacketInventoryAction p;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, null );
|
|
|
|
NetworkHandler.instance.sendToServer( p );
|
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
{
|
|
|
|
AELog.error( e );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-17 01:50:25 +01:00
|
|
|
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
2014-02-05 03:44:54 +01:00
|
|
|
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
|
|
|
|
reservedSpace = 73;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected String getBackground()
|
|
|
|
{
|
|
|
|
return "guis/crafting.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
|
|
|
{
|
|
|
|
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
2014-02-09 02:34:52 +01:00
|
|
|
fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
|
2014-02-05 03:44:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|