Interface Gui mostly done.

This commit is contained in:
AlgorithmX2 2013-12-28 15:03:20 -06:00
parent cae20d72fc
commit ad1b341ecf
4 changed files with 87 additions and 14 deletions

View file

@ -0,0 +1,36 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerInterface;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileInterface;
public class GuiInterface extends AEBaseGui
{
public GuiInterface(InventoryPlayer inventoryPlayer, TileInterface te) {
super( new ContainerInterface( inventoryPlayer, te ) );
this.ySize = 211;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
bindTexture( "guis/interface.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.Interface.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8 + 18, 6 + 60 + 7, 4210752 );
fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
}
}

View file

@ -0,0 +1,32 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotNormal;
import appeng.container.slot.SlotRestrictedInput;
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
import appeng.tile.misc.TileInterface;
public class ContainerInterface extends AEBaseContainer
{
TileInterface myte;
public ContainerInterface(InventoryPlayer ip, TileInterface te) {
super( ip, te );
myte = te;
for (int x = 0; x < 8; x++)
addSlotToContainer( new SlotFake( myte.getConfig(), x, 8 + 18 * x, 28 + 7 ) );
for (int x = 0; x < 8; x++)
addSlotToContainer( new SlotNormal( myte, x, 26 + 18 * x, 46 + 7 ) );
for (int x = 0; x < 9; x++)
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myte.getPatterns(), x, 8 + 18 * x, 90 + 7 ) );
bindPlayerInventory( ip, 0, 211 - /* height of playerinventory */82 );
}
}

View file

@ -7,7 +7,7 @@ public enum GuiText
{
inventory("container"), // mc's default Inventory localization.
Chest, StoredEnergy, Of, Condenser, Drive, GrindStone, VibrationChamber, SpatialIOPort, NetworkStatus, LevelEmitter, Terminal;
Chest, StoredEnergy, Of, Condenser, Drive, GrindStone, VibrationChamber, SpatialIOPort, NetworkStatus, LevelEmitter, Terminal, Interface, Config, StoredItems, Patterns;
String root;

View file

@ -1,6 +1,7 @@
package appeng.core.sync;
import java.lang.reflect.Constructor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntity;
@ -16,10 +17,12 @@ import appeng.container.implementations.ContainerChest;
import appeng.container.implementations.ContainerCondenser;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerGrinder;
import appeng.container.implementations.ContainerInterface;
import appeng.container.implementations.ContainerMEMonitorable;
import appeng.container.implementations.ContainerVibrationChamber;
import appeng.tile.grindstone.TileGrinder;
import appeng.tile.misc.TileCondenser;
import appeng.tile.misc.TileInterface;
import appeng.tile.misc.TileVibrationChamber;
import appeng.tile.storage.TileChest;
import appeng.tile.storage.TileDrive;
@ -41,7 +44,9 @@ public enum GuiBridge implements IGuiHandler
GUI_VIBRATIONCHAMBER(ContainerVibrationChamber.class, TileVibrationChamber.class),
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class);
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class),
GUI_INTERFACE(ContainerInterface.class, TileInterface.class);
private Class Tile;
private Class Gui;
@ -106,7 +111,7 @@ public enum GuiBridge implements IGuiHandler
}
}
public Object ConstructGui(InventoryPlayer inventory,ForgeDirection side, Object tE)
public Object ConstructGui(InventoryPlayer inventory, ForgeDirection side, Object tE)
{
try
{
@ -124,7 +129,7 @@ public enum GuiBridge implements IGuiHandler
@Override
public Object getServerGuiElement(int ID_ORDINAL, EntityPlayer player, World w, int x, int y, int z)
{
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL& 0x07 );
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
GuiBridge ID = values()[ID_ORDINAL >> 3];
TileEntity TE = w.getBlockTileEntity( x, y, z );
@ -132,32 +137,32 @@ public enum GuiBridge implements IGuiHandler
if ( TE instanceof IPartHost )
{
((IPartHost) TE).getPart( side );
IPart part = ((IPartHost) TE).getPart(side);
if ( ID.CorrectTileOrPart(part) )
IPart part = ((IPartHost) TE).getPart( side );
if ( ID.CorrectTileOrPart( part ) )
return ID.ConstructContainer( player.inventory, side, part );
}
else
{
if ( ID.CorrectTileOrPart( TE ) )
return ID.ConstructContainer( player.inventory, side, TE );
if ( ID.CorrectTileOrPart( TE ) )
return ID.ConstructContainer( player.inventory, side, TE );
}
return new ContainerNull();
}
@Override
public Object getClientGuiElement(int ID_ORDINAL, EntityPlayer player, World w, int x, int y, int z)
{
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL& 0x07 );
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
GuiBridge ID = values()[ID_ORDINAL >> 3];
TileEntity TE = w.getBlockTileEntity( x, y, z );
if ( TE instanceof IPartHost )
{
((IPartHost) TE).getPart( side );
IPart part = ((IPartHost) TE).getPart(side);
if ( ID.CorrectTileOrPart(part) )
IPart part = ((IPartHost) TE).getPart( side );
if ( ID.CorrectTileOrPart( part ) )
return ID.ConstructGui( player.inventory, side, part );
}
else
@ -165,7 +170,7 @@ public enum GuiBridge implements IGuiHandler
if ( ID.CorrectTileOrPart( TE ) )
return ID.ConstructGui( player.inventory, side, TE );
}
return new GuiNull( new ContainerNull() );
}