Reformatted some GUI

This commit is contained in:
Calclavia 2012-11-03 11:56:51 +08:00
parent cefb0245bd
commit bd78faab1f
5 changed files with 118 additions and 109 deletions

View file

@ -3,19 +3,15 @@ package assemblyline.ai;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.src.TileEntity;
import cpw.mods.fml.common.FMLLog;
import universalelectricity.prefab.TileEntityAdvanced;
public class TileEntityAI extends TileEntityAdvanced
public class TaskManager
{
private final List<Task> tasks = new ArrayList<Task>();
public void updateEntity()
public void onUpdate()
{
super.updateEntity();
/**
* Loop through each task and do them.
*/
@ -43,9 +39,9 @@ public class TileEntityAI extends TileEntityAdvanced
}
}
public void addTask(Task task)
public void addTask(TileEntity tileEntity, Task task)
{
task.setTileEntity(this);
task.setTileEntity(tileEntity);
task.onTaskStart();
tasks.add(task);
}

View file

@ -18,13 +18,19 @@ public class GuiAutoCrafting extends GuiContainer
public GuiAutoCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
//TODO on opening if the user is not the owner they can see the crafting recipes but if
//the machine is locked they can't do anything with it
//Also the need to add a locking button can only be activate by the owner
// TODO on opening if the user is not the
// owner they can see the crafting recipes
// but if
// the machine is locked they can't do
// anything with it
// Also the need to add a locking button
// can only be activate by the owner
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
* Draw the foreground layer for the
* GuiContainer (everything in front of the
* items)
*/
protected void drawGuiContainerForegroundLayer()
{
@ -33,7 +39,8 @@ public class GuiAutoCrafting extends GuiContainer
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
* Draw the background layer for the
* GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{

View file

@ -7,8 +7,11 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
/**
* Copied from GSM lib and modified for this mod only
* Copied from GSM lib and modified for this mod
* only
*
* @author Rseifert
*
*/
@ -16,6 +19,7 @@ import cpw.mods.fml.common.asm.SideOnly;
public class GuiButtonImage extends GuiButton
{
private int type = 0;
public GuiButtonImage(int par1, int par2, int par3, int type)
{
super(par1, par2, par3, 12, 12, "");

View file

@ -12,19 +12,21 @@ import assemblyline.AssemblyLine;
import assemblyline.machines.ContainerSorter;
import assemblyline.machines.TileEntitySorter;
public class GuiSorter extends GuiContainer {
public class GuiSorter extends GuiContainer
{
private TileEntitySorter tileEntity;
private int containerWidth;
private int containerHeight;
public GuiSorter(InventoryPlayer par1InventoryPlayer,
TileEntitySorter tileEntity) {
public GuiSorter(InventoryPlayer par1InventoryPlayer, TileEntitySorter tileEntity)
{
super(new ContainerSorter(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
public void initGui() {
public void initGui()
{
super.initGui();
Keyboard.enableRepeatEvents(true);
this.controlList.clear();
@ -37,13 +39,16 @@ public class GuiSorter extends GuiContainer {
}
}
public void updateScreen() {
public void updateScreen()
{
super.updateScreen();
}
/**
* Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
* Fired when a control is clicked. This is
* the equivalent of
* ActionListener.actionPerformed(ActionEvent
* e).
*/
protected void actionPerformed(GuiButton button)
{
@ -54,56 +59,53 @@ public class GuiSorter extends GuiContainer {
super.actionPerformed(button);
}
protected void keyTyped(char par1, int par2) {
protected void keyTyped(char par1, int par2)
{
super.keyTyped(par1, par2);
}
protected void mouseClicked(int par1, int par2, int par3) {
protected void mouseClicked(int par1, int par2, int par3)
{
super.mouseClicked(par1, par2, par3);
}
public void onGuiClosed() {
public void onGuiClosed()
{
super.onGuiClosed();
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRenderer.drawString(this.tileEntity.getInvName(), 55, 6, 4210752);
this.fontRenderer.drawString(
"Voltage: " + (int) this.tileEntity.getVoltage(), 95, 60,
4210752);
this.fontRenderer.drawString(
StatCollector.translateToLocal("container.inventory"), 8,
this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* Draw the foreground layer for the
* GuiContainer (everything in front of the
* items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2,
int par3) {
int var4 = this.mc.renderEngine.getTexture(AssemblyLine.TEXTURE_PATH
+ "gui_ejector.png");
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString(this.tileEntity.getInvName(), 55, 6, 4210752);
this.fontRenderer.drawString("Voltage: " + (int) this.tileEntity.getVoltage(), 95, 60, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the
* GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "gui_ejector.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
containerWidth = (this.width - this.xSize) / 2;
containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0,
this.xSize, this.ySize);
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
// GUI button changes
for (int i = 1; i < this.tileEntity.guiButtons.length; i++)
{
this.drawTexturedModalRect(containerWidth + 17 + i * 18, containerHeight + 17, 176, +(tileEntity.guiButtons[i] ? 12 : 0), 12, 12);
}
this.fontRenderer.drawString(
"Reject: "+(tileEntity.guiButtons[0] ? "Inv" : "Other"), containerWidth + 108,
containerHeight +22, 4210752);
this.fontRenderer.drawString("Reject: " + (tileEntity.guiButtons[0] ? "Inv" : "Other"), containerWidth + 108, containerHeight + 22, 4210752);
}
}