2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-02-05 03:44:54 +01:00
|
|
|
package appeng.client.gui.implementations;
|
|
|
|
|
2014-02-27 05:47:06 +01:00
|
|
|
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;
|
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();
|
2014-12-29 15:13:47 +01:00
|
|
|
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
|
|
|
|
this.clearBtn.halfSize = true;
|
2014-02-27 05:47:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void actionPerformed(GuiButton btn)
|
|
|
|
{
|
|
|
|
super.actionPerformed( btn );
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
if ( this.clearBtn == btn )
|
2014-02-27 05:47:06 +01:00
|
|
|
{
|
|
|
|
Slot s = null;
|
2014-12-29 15:13:47 +01:00
|
|
|
Container c = this.inventorySlots;
|
2014-02-27 05:47:06 +01:00
|
|
|
for (Object j : c.inventorySlots)
|
|
|
|
{
|
|
|
|
if ( j instanceof SlotCraftingMatrix )
|
|
|
|
s = (Slot) j;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( s != null )
|
|
|
|
{
|
|
|
|
PacketInventoryAction p;
|
2014-10-04 08:08:28 +02:00
|
|
|
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
|
|
|
|
NetworkHandler.instance.sendToServer( p );
|
2014-02-27 05:47:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 ) );
|
2014-12-29 15:13:47 +01:00
|
|
|
this.reservedSpace = 73;
|
2014-02-05 03:44:54 +01:00
|
|
|
}
|
|
|
|
|
2014-09-28 20:34:00 +02:00
|
|
|
@Override
|
2014-02-05 03:44:54 +01:00
|
|
|
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-12-29 15:13:47 +01:00
|
|
|
this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
|
2014-02-05 03:44:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|