Bus Guis.

This commit is contained in:
AlgorithmX2 2013-12-29 23:56:43 -06:00
parent bc335ac5d6
commit 7856d13f16
3 changed files with 128 additions and 1 deletions

View file

@ -0,0 +1,40 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.implementations.IBusCommon;
import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerBus;
import appeng.core.localization.GuiText;
public class GuiBus extends AEBaseGui
{
public GuiBus(InventoryPlayer inventoryPlayer, IBusCommon te) {
super( new ContainerBus( inventoryPlayer, te ) );
this.xSize = hasToolbox() ? 246 : 211;
this.ySize = 184;
}
private boolean hasToolbox()
{
return ((ContainerBus) inventorySlots).hasToolbox();
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
bindTexture( "guis/bus.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize - 34, ySize );
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 86 );
if ( hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + 94, 178, 94, 68, 68 );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.Drive.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
}
}

View file

@ -0,0 +1,83 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.implementations.IBusCommon;
import appeng.container.AEBaseContainer;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotRestrictedInput;
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
import appeng.tile.inventory.AppEngInternalInventory;
public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
{
IBusCommon myte;
IInventory toolbox = new AppEngInternalInventory( null, 9 );
public ContainerBus(InventoryPlayer ip, IBusCommon te) {
super( ip, null );
myte = te;
IInventory upgrades = myte.getInventoryByName( "upgrades" );
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 ) );
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 ) );
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 ) );
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 ) );
if ( hasToolbox() )
{
for (int v = 0; v < 3; v++)
for (int u = 0; u < 3; u++)
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, toolbox, u + v * 3, 186 + u * 18, 102 + v * 18 )).setPlayerSide() );
}
int x = 80;
int y = 40;
IInventory inv = myte.getInventoryByName( "config" );
addSlotToContainer( new SlotFake( inv, 0, x, y ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 1, x, y, -1, 0, 1 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 2, x, y, 1, 0, 1 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 3, x, y, 0, -1, 1 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 4, x, y, 0, 1, 1 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 5, x, y, -1, -1, 2 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 6, x, y, 1, -1, 2 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 7, x, y, -1, 1, 2 ) );
addSlotToContainer( new OptionalSlotFake( inv, this, 8, x, y, 1, 1, 2 ) );
/*
* addSlotToContainer( new OptionalSlotFake( inv, this, 9, x, y, -2, 0, 3 ) ); addSlotToContainer( new
* OptionalSlotFake( inv, this, 10, x, y, 2, 0, 3 ) ); addSlotToContainer( new OptionalSlotFake( inv, this, 11,
* x, y, 0, -2, 3 ) ); addSlotToContainer( new OptionalSlotFake( inv, this, 12, x, y, 0, 2, 3 ) );
*
* addSlotToContainer( new OptionalSlotFake( inv, this, 13, x, y, 2, 1, 4 ) ); addSlotToContainer( new
* OptionalSlotFake( inv, this, 14, x, y, 2, -1, 4 ) ); addSlotToContainer( new OptionalSlotFake( inv, this, 15,
* x, y, -2, -1, 4 ) ); addSlotToContainer( new OptionalSlotFake( inv, this, 16, x, y, -2, 1, 4 ) );
*/
bindPlayerInventory( ip, 0, 184 - /* height of playerinventory */82 );
}
public boolean hasToolbox()
{
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isSlotEnabled(int idx, OptionalSlotFake osf)
{
if ( idx == 1 )
return true;
if ( idx == 2 )
return true;
return false;
}
}

View file

@ -8,11 +8,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import appeng.api.exceptions.AppEngException; import appeng.api.exceptions.AppEngException;
import appeng.api.implementations.IBusCommon;
import appeng.api.implementations.IStorageMonitorable; import appeng.api.implementations.IStorageMonitorable;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.client.gui.GuiNull; import appeng.client.gui.GuiNull;
import appeng.container.ContainerNull; import appeng.container.ContainerNull;
import appeng.container.implementations.ContainerBus;
import appeng.container.implementations.ContainerChest; import appeng.container.implementations.ContainerChest;
import appeng.container.implementations.ContainerCondenser; import appeng.container.implementations.ContainerCondenser;
import appeng.container.implementations.ContainerDrive; import appeng.container.implementations.ContainerDrive;
@ -46,7 +48,9 @@ public enum GuiBridge implements IGuiHandler
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class), GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class),
GUI_INTERFACE(ContainerInterface.class, TileInterface.class); GUI_INTERFACE(ContainerInterface.class, TileInterface.class),
GUI_BUS(ContainerBus.class, IBusCommon.class);
private Class Tile; private Class Tile;
private Class Gui; private Class Gui;