Reformatted some GUI
This commit is contained in:
parent
cefb0245bd
commit
bd78faab1f
5 changed files with 118 additions and 109 deletions
|
@ -3,19 +3,15 @@ package assemblyline.ai;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.src.TileEntity;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
|
||||||
import universalelectricity.prefab.TileEntityAdvanced;
|
public class TaskManager
|
||||||
|
|
||||||
public class TileEntityAI extends TileEntityAdvanced
|
|
||||||
{
|
{
|
||||||
private final List<Task> tasks = new ArrayList<Task>();
|
private final List<Task> tasks = new ArrayList<Task>();
|
||||||
|
|
||||||
public void updateEntity()
|
public void onUpdate()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loop through each task and do them.
|
* 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();
|
task.onTaskStart();
|
||||||
tasks.add(task);
|
tasks.add(task);
|
||||||
}
|
}
|
|
@ -18,13 +18,19 @@ public class GuiAutoCrafting extends GuiContainer
|
||||||
public GuiAutoCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
|
public GuiAutoCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, 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
|
// TODO on opening if the user is not the
|
||||||
//the machine is locked they can't do anything with it
|
// owner they can see the crafting recipes
|
||||||
//Also the need to add a locking button can only be activate by the owner
|
// 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()
|
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)
|
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,11 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
import cpw.mods.fml.common.Side;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
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
|
* @author Rseifert
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +19,7 @@ import cpw.mods.fml.common.asm.SideOnly;
|
||||||
public class GuiButtonImage extends GuiButton
|
public class GuiButtonImage extends GuiButton
|
||||||
{
|
{
|
||||||
private int type = 0;
|
private int type = 0;
|
||||||
|
|
||||||
public GuiButtonImage(int par1, int par2, int par3, int type)
|
public GuiButtonImage(int par1, int par2, int par3, int type)
|
||||||
{
|
{
|
||||||
super(par1, par2, par3, 12, 12, "");
|
super(par1, par2, par3, 12, 12, "");
|
||||||
|
|
|
@ -12,19 +12,21 @@ import assemblyline.AssemblyLine;
|
||||||
import assemblyline.machines.ContainerSorter;
|
import assemblyline.machines.ContainerSorter;
|
||||||
import assemblyline.machines.TileEntitySorter;
|
import assemblyline.machines.TileEntitySorter;
|
||||||
|
|
||||||
public class GuiSorter extends GuiContainer {
|
public class GuiSorter extends GuiContainer
|
||||||
|
{
|
||||||
private TileEntitySorter tileEntity;
|
private TileEntitySorter tileEntity;
|
||||||
|
|
||||||
private int containerWidth;
|
private int containerWidth;
|
||||||
private int containerHeight;
|
private int containerHeight;
|
||||||
|
|
||||||
public GuiSorter(InventoryPlayer par1InventoryPlayer,
|
public GuiSorter(InventoryPlayer par1InventoryPlayer, TileEntitySorter tileEntity)
|
||||||
TileEntitySorter tileEntity) {
|
{
|
||||||
super(new ContainerSorter(par1InventoryPlayer, tileEntity));
|
super(new ContainerSorter(par1InventoryPlayer, tileEntity));
|
||||||
this.tileEntity = tileEntity;
|
this.tileEntity = tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initGui() {
|
public void initGui()
|
||||||
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
Keyboard.enableRepeatEvents(true);
|
Keyboard.enableRepeatEvents(true);
|
||||||
this.controlList.clear();
|
this.controlList.clear();
|
||||||
|
@ -37,13 +39,16 @@ public class GuiSorter extends GuiContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateScreen() {
|
public void updateScreen()
|
||||||
|
{
|
||||||
super.updateScreen();
|
super.updateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired when a control is clicked. This is the equivalent of
|
* Fired when a control is clicked. This is
|
||||||
* ActionListener.actionPerformed(ActionEvent e).
|
* the equivalent of
|
||||||
|
* ActionListener.actionPerformed(ActionEvent
|
||||||
|
* e).
|
||||||
*/
|
*/
|
||||||
protected void actionPerformed(GuiButton button)
|
protected void actionPerformed(GuiButton button)
|
||||||
{
|
{
|
||||||
|
@ -54,56 +59,53 @@ public class GuiSorter extends GuiContainer {
|
||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void keyTyped(char par1, int par2) {
|
protected void keyTyped(char par1, int par2)
|
||||||
|
{
|
||||||
super.keyTyped(par1, 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);
|
super.mouseClicked(par1, par2, par3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed()
|
||||||
|
{
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the foreground layer for the GuiContainer (everything in front of
|
* Draw the foreground layer for the
|
||||||
* the items)
|
* GuiContainer (everything in front of the
|
||||||
*/
|
|
||||||
@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
|
|
||||||
* items)
|
* items)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2,
|
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||||
int par3) {
|
{
|
||||||
int var4 = this.mc.renderEngine.getTexture(AssemblyLine.TEXTURE_PATH
|
this.fontRenderer.drawString(this.tileEntity.getInvName(), 55, 6, 4210752);
|
||||||
+ "gui_ejector.png");
|
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);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.renderEngine.bindTexture(var4);
|
this.mc.renderEngine.bindTexture(var4);
|
||||||
containerWidth = (this.width - this.xSize) / 2;
|
containerWidth = (this.width - this.xSize) / 2;
|
||||||
containerHeight = (this.height - this.ySize) / 2;
|
containerHeight = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0,
|
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
|
||||||
this.xSize, this.ySize);
|
|
||||||
|
|
||||||
// GUI button changes
|
// GUI button changes
|
||||||
for (int i = 1; i < this.tileEntity.guiButtons.length; i++)
|
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.drawTexturedModalRect(containerWidth + 17 + i * 18, containerHeight + 17, 176, +(tileEntity.guiButtons[i] ? 12 : 0), 12, 12);
|
||||||
}
|
}
|
||||||
this.fontRenderer.drawString(
|
this.fontRenderer.drawString("Reject: " + (tileEntity.guiButtons[0] ? "Inv" : "Other"), containerWidth + 108, containerHeight + 22, 4210752);
|
||||||
"Reject: "+(tileEntity.guiButtons[0] ? "Inv" : "Other"), containerWidth + 108,
|
|
||||||
containerHeight +22, 4210752);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue