Worked on encoder

We have something though its not much. The encoder now has an inventory,
code, and help gui. The inventory gui needs a slot for the disk and
possible more slots for other disk. Possible should add a way to clear
the disk and clone to another disk. The code gui is not close to finish
though it now does render parts of the task. Still working on lining
things up and thinking about expanding the size. The help gui has
nothing.
This commit is contained in:
DarkGuardsman 2013-10-23 22:51:38 -04:00
parent 5cbfbec692
commit 4de3b2ab39
24 changed files with 629 additions and 343 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

View file

@ -46,6 +46,9 @@ public interface IProgram extends Cloneable
/** Gets a declared variable */
public Object getVar(String name);
/** return size in commands high and wide */
public Vector2 getSize();
public NBTTagCompound save(NBTTagCompound nbt);
public void load(NBTTagCompound nbt);

View file

@ -9,7 +9,8 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.client.gui.GuiEncoder;
import dark.assembly.client.gui.GuiEncoderCoder;
import dark.assembly.client.gui.GuiEncoderInventory;
import dark.assembly.client.gui.GuiImprinter;
import dark.assembly.client.gui.GuiProcessor;
import dark.assembly.client.render.BlockRenderingHandler;
@ -72,7 +73,15 @@ public class ClientProxy extends CommonProxy
}
case GUI_ENCODER:
{
return new GuiEncoder(player.inventory, (TileEntityEncoder) tileEntity);
return new GuiEncoderInventory(player.inventory, (TileEntityEncoder) tileEntity);
}
case GUI_ENCODER_CODE:
{
return new GuiEncoderCoder(player, (TileEntityEncoder) tileEntity);
}
case GUI_ENCODER_HELP:
{
return new GuiEncoderCoder(player, (TileEntityEncoder) tileEntity);
}
case GUI_PROCESSOR:
{

View file

@ -1,44 +0,0 @@
package dark.assembly.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.common.AssemblyLine;
@SideOnly(Side.CLIENT)
public class GuiAutoCrafting extends GuiContainer
{
private static final ResourceLocation gui_pic = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_crafting.png");
public GuiAutoCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
}
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("AutoCrafter"), 28, 6, 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)
{
this.mc.renderEngine.bindTexture(gui_pic);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -1,118 +0,0 @@
package dark.assembly.client.gui;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.GuiScrollingList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiCommandList extends GuiScrollingList
{
private ArrayList<String> commands;
private int selIndex;
private Minecraft mc;
public GuiCommandList(Minecraft client, int width, int height, int top, int bottom, int left, int entryHeight)
{
super(client, width, height, top, bottom, left, entryHeight);
commands = new ArrayList<String>();
selIndex = -1;
this.mc = client;
}
public void setCommands(ArrayList<String> commands)
{
this.commands = (ArrayList<String>) commands.clone();
}
@Override
protected int getSize()
{
return commands.size();
}
@Override
protected void elementClicked(int index, boolean doubleClick)
{
selIndex = index;
}
@Override
protected boolean isSelected(int index)
{
return selIndex == index;
}
@Override
protected void drawBackground()
{
drawOutlineRect(this.left, this.left + this.listWidth, this.top, this.top + this.listHeight, 0, 0, 0, 0.5f, 0.5f, 0.5f);
}
public static void drawOutlineRect(int x1, int y1, int x2, int y2, float rR, float rG, float rB, float lR, float lG, float lB)
{
Tessellator tesselator = Tessellator.instance;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(rR, rG, rB, 1f);
if (rR > 0 && rG > 0 && rB > 0)
{
// background
tesselator.startDrawingQuads();
tesselator.addVertex(x1, y2, 0.0D);
tesselator.addVertex(x2, y2, 0.0D);
tesselator.addVertex(x2, y1, 0.0D);
tesselator.addVertex(x1, y1, 0.0D);
tesselator.draw();
}
// outline
GL11.glColor4f(lR, lG, lB, 1f);
tesselator.startDrawingQuads();
tesselator.addVertex(x1, y1, 0.0D);
tesselator.addVertex(x1, y2, 0.0D);
tesselator.addVertex((double) x1 + 1, y2, 0.0D);
tesselator.addVertex((double) x1 + 1, y1, 0.0D);
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.addVertex((double) x2 - 1, y1, 0.0D);
tesselator.addVertex((double) x2 - 1, y2, 0.0D);
tesselator.addVertex(x2, y2, 0.0D);
tesselator.addVertex(x2, y1, 0.0D);
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.addVertex(x1, y1, 0.0D);
tesselator.addVertex(x1, (double) y1 + 1, 0.0D);
tesselator.addVertex(x2, (double) y1 + 1, 0.0D);
tesselator.addVertex(x2, y1, 0.0D);
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.addVertex(x1, (double) y2 - 1, 0.0D);
tesselator.addVertex(x1, y2, 0.0D);
tesselator.addVertex(x2, y2, 0.0D);
tesselator.addVertex(x2, (double) y2 - 1, 0.0D);
tesselator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
@Override
protected void drawSlot(int slotID, int width, int slotY, int slotHeight, Tessellator tessellator)
{
if (slotID < commands.size())
{
String command = commands.get(slotID);
if (isSelected(slotID))
drawOutlineRect(this.left, this.left + width, this.top + slotY, this.top + slotY + slotHeight, -1, -1, -1, 0.5f, 0.5f, 0.5f);
this.mc.fontRenderer.drawString(command, this.left + 4, slotY + 4, 0xAAAAAA, false);
}
}
}

View file

@ -1,144 +0,0 @@
package dark.assembly.client.gui;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.glColor4f;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import universalelectricity.prefab.TranslationHelper;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.machine.encoder.ContainerEncoder;
import dark.assembly.common.machine.encoder.IInventoryWatcher;
import dark.assembly.common.machine.encoder.ItemDisk;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
import dark.core.common.DarkMain;
import dark.core.network.PacketHandler;
import dark.core.prefab.ModPrefab;
@SideOnly(Side.CLIENT)
public class GuiEncoder extends GuiContainer implements IInventoryWatcher
{
private static final int MAX_COMMANDS = 6;
private int containerWidth;
private int containerHeight;
private TileEntityEncoder tileEntity;
private ArrayList<String> commands;
// list stuff
private int minCommand;
private int selCommand;
private GuiButton encodeButton;
private GuiButton clearButton;
public GuiEncoder(InventoryPlayer playerInventory, TileEntityEncoder tileEntity)
{
super(new ContainerEncoder(playerInventory, tileEntity));
this.ySize = 237;
this.tileEntity = tileEntity;
tileEntity.setWatcher(this);
}
@Override
public void initGui()
{
super.initGui();
this.allowUserInput = true;
Keyboard.enableRepeatEvents(true);
this.containerWidth = (this.width - this.xSize) / 2;
this.containerHeight = (this.height - this.ySize) / 2;
this.encodeButton = new GuiButton(0, containerWidth + (xSize - 25), containerHeight + 128 + ContainerEncoder.Y_OFFSET, 18, 20, "Code");
this.clearButton = new GuiButton(1, containerWidth + (xSize - 43), containerHeight + 128 + ContainerEncoder.Y_OFFSET, 18, 20, "Erase");
this.buttonList.add(encodeButton);
this.buttonList.add(clearButton);
this.commands = new ArrayList<String>();
this.minCommand = 0;
this.selCommand = -1;
}
@Override
protected void actionPerformed(GuiButton button)
{
}
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
glColor4f(1, 1, 1, 1);
glDisable(GL_LIGHTING);
this.fontRenderer.drawString(TranslationHelper.getLocal("tile.encoder.name"), 68, 8 + ContainerEncoder.Y_OFFSET, 4210752);
this.fontRenderer.drawString("Disk:", 56, 28 + ContainerEncoder.Y_OFFSET, 4210752);
}
@Override
protected void mouseClicked(int x, int y, int button)
{
super.mouseClicked(x, y, button);
}
@Override
protected void keyTyped(char character, int keycode)
{
if (character != 'e' && character != 'E')
{
super.keyTyped(character, keycode);
}
if (keycode == Keyboard.KEY_ESCAPE)
{
this.mc.thePlayer.closeScreen();
}
}
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
this.mc.renderEngine.bindTexture(new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.GUI_DIRECTORY + "gui_encoder.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(containerWidth, containerHeight + ContainerEncoder.Y_OFFSET, 0, 0, this.xSize, this.ySize);
}
@Override
public void onGuiClosed()
{
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}
@Override
public void inventoryChanged()
{
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,178 @@
package dark.assembly.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import calclavia.lib.gui.GuiBase;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.CommonProxy;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
import dark.core.prefab.invgui.GuiButtonImage;
/** A base class for all ICBM Sentry GUIs.
*
* @author Calclavia */
@SideOnly(Side.CLIENT)
public abstract class GuiEncoderBase extends GuiBase
{
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_base.png");
protected static final int MAX_BUTTON_ID = 3;
protected TileEntityEncoder tileEntity;
protected EntityPlayer entityPlayer;
public GuiEncoderBase(EntityPlayer player, TileEntityEncoder tileEntity)
{
this.tileEntity = tileEntity;
this.entityPlayer = player;
this.ySize = 380 / 2;
}
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
// Inventory
this.buttonList.add(new GuiButtonImage(0, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 0, 3));
// Coding
this.buttonList.add(new GuiButtonImage(1, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 22, 0));
// Help
this.buttonList.add(new GuiButtonImage(2, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 44, 2));
}
@Override
protected void actionPerformed(GuiButton button)
{
switch (button.id)
{
case 0:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
case 1:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_CODE, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
case 2:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_HELP, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
}
}
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
@Override
protected void drawForegroundLayer(int x, int y, float var1)
{
this.fontRenderer.drawString("\u00a77" + "Encoder", (int) (this.xSize / 2 - 7 * 2.5), 4, 4210752);
/** Render Tool Tips */
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Inventory");
}
else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Coder");
}
else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Help");
}
}
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawBackgroundLayer(int x, int y, float var1)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
@Override
public void drawTooltip(int x, int y, String... toolTips)
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (toolTips != null)
{
int var5 = 0;
int var6;
int var7;
for (var6 = 0; var6 < toolTips.length; ++var6)
{
var7 = this.fontRenderer.getStringWidth(toolTips[var6]);
if (var7 > var5)
{
var5 = var7;
}
}
var6 = x + 12;
var7 = y - 12;
int var9 = 8;
if (toolTips.length > 1)
{
var9 += 2 + (toolTips.length - 1) * 10;
}
if (this.guiTop + var7 + var9 + 6 > this.height)
{
var7 = this.height - var9 - this.guiTop - 6;
}
this.zLevel = 300.0F;
int var10 = -267386864;
this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10);
this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10);
int var11 = 1347420415;
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11);
this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
for (int var13 = 0; var13 < toolTips.length; ++var13)
{
String var14 = "\u00a77" + toolTips[var13];
this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
if (var13 == 0)
{
var7 += 2;
}
var7 += 10;
}
this.zLevel = 0.0F;
}
}
}

View file

@ -0,0 +1,40 @@
package dark.assembly.client.gui;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
import dark.core.prefab.invgui.GuiButtonImage;
public class GuiEncoderCoder extends GuiEncoderBase
{
public static final ResourceLocation TEXTURE_CODE_BACK = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_encoder_coder.png");
private GuiTaskList taskListGui;
public GuiEncoderCoder(EntityPlayer player, TileEntityEncoder tileEntity)
{
super(player, tileEntity);
}
@Override
protected void drawBackgroundLayer(int x, int y, float var1)
{
if (taskListGui == null)
{
taskListGui = new GuiTaskList((this.width - this.xSize) / 2 + 20, (this.height - this.ySize) / 2 + 40);
}
super.drawBackgroundLayer(x, y, var1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CODE_BACK);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
taskListGui.drawConsole(this.fontRenderer);
}
}

View file

@ -0,0 +1,182 @@
package dark.assembly.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.CommonProxy;
import dark.assembly.common.machine.encoder.ContainerEncoder;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
import dark.core.prefab.invgui.GuiButtonImage;
@SideOnly(Side.CLIENT)
public abstract class GuiEncoderContainer extends GuiContainer
{
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_base.png");
protected static final int MAX_BUTTON_ID = 3;
protected TileEntityEncoder tileEntity;
protected EntityPlayer entityPlayer;
public GuiEncoderContainer(InventoryPlayer inventoryPlayer, TileEntityEncoder tileEntity)
{
super(new ContainerEncoder(inventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
this.entityPlayer = inventoryPlayer.player;
this.ySize = 380 / 2;
}
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
// Terminal
this.buttonList.add(new GuiButtonImage(0, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 0, 3));
// Access
this.buttonList.add(new GuiButtonImage(1, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 22, 0));
// Ammunition
this.buttonList.add(new GuiButtonImage(2, (this.width - this.xSize) / 2 - 22, (this.height - this.ySize) / 2 + 44, 2));
// Protection
// this.buttonList.add(new GuiButtonImage(3, (this.width - this.xSize) /
// 2 - 22,
// (this.height - this.ySize) / 2 + 66, 1));
}
@Override
protected void actionPerformed(GuiButton button)
{
switch (button.id)
{
case 0:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
case 1:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_CODE, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
case 2:
{
this.entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_ENCODER_HELP, this.tileEntity.worldObj, this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
break;
}
}
}
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
this.fontRenderer.drawString("\u00a77" + "encoder", (int) (this.xSize / 2 - 7 * 2.5), 4, 4210752);
/** Render Tool Tips */
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Inventory");
}
else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Coder");
}
else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y))
{
this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Help");
}
}
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
public void drawTooltip(int x, int y, String... toolTips)
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (toolTips != null)
{
int var5 = 0;
int var6;
int var7;
for (var6 = 0; var6 < toolTips.length; ++var6)
{
var7 = this.fontRenderer.getStringWidth(toolTips[var6]);
if (var7 > var5)
{
var5 = var7;
}
}
var6 = x + 12;
var7 = y - 12;
int var9 = 8;
if (toolTips.length > 1)
{
var9 += 2 + (toolTips.length - 1) * 10;
}
if (this.guiTop + var7 + var9 + 6 > this.height)
{
var7 = this.height - var9 - this.guiTop - 6;
}
this.zLevel = 300.0F;
int var10 = -267386864;
this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10);
this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10);
this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10);
int var11 = 1347420415;
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12);
this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11);
this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
for (int var13 = 0; var13 < toolTips.length; ++var13)
{
String var14 = "\u00a77" + toolTips[var13];
this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
if (var13 == 0)
{
var7 += 2;
}
var7 += 10;
}
this.zLevel = 0.0F;
}
}
}

View file

@ -0,0 +1,24 @@
package dark.assembly.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
public class GuiEncoderHelp extends GuiEncoderBase
{
public static final ResourceLocation TEXTURE_CODE_BACK = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_encoder_coder.png");
public GuiEncoderHelp(EntityPlayer player, TileEntityEncoder tileEntity)
{
super(player, tileEntity);
}
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
@Override
protected void drawForegroundLayer(int x, int y, float var1)
{
String out = "Help for using the encoder is currently not ready";
this.fontRenderer.drawString("\u00a77" + out, (int) (this.xSize / 2 - out.length() * 2.5), 20, 4210752);
}
}

View file

@ -0,0 +1,37 @@
package dark.assembly.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.machine.encoder.TileEntityEncoder;
@SideOnly(Side.CLIENT)
public class GuiEncoderInventory extends GuiEncoderContainer
{
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "gui_encoder_slot.png");
public GuiEncoderInventory(InventoryPlayer inventoryPlayer, TileEntityEncoder tileEntity)
{
super(inventoryPlayer, tileEntity);
}
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y)
{
super.drawGuiContainerBackgroundLayer(par1, x, y);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -1,22 +0,0 @@
package dark.assembly.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
public class GuiProgrammer extends GuiContainer
{
public GuiProgrammer(Container par1Container)
{
super(par1Container);
// TODO Auto-generated constructor stub
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,130 @@
package dark.assembly.client.gui;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import universalelectricity.core.vector.Vector2;
import dark.api.al.coding.IProgram;
import dark.api.al.coding.IRedirectTask;
import dark.api.al.coding.ITask;
import dark.assembly.common.AssemblyLine;
import dark.assembly.common.armbot.Program;
import dark.assembly.common.armbot.command.TaskGive;
import dark.core.interfaces.IScroll;
public class GuiTaskList extends Gui implements IScroll
{
protected IProgram program;
protected int scroll = 0;
/** The x position of this control. */
public int xPosition;
/** The y position of this control. */
public int yPosition;
/** The string displayed on this control. */
public String displayString;
public static final ResourceLocation TEXTURE_PROCESS = new ResourceLocation(AssemblyLine.instance.DOMAIN, AssemblyLine.GUI_DIRECTORY + "PROCESS.png");
public GuiTaskList(int x, int y)
{
this.xPosition = x;
this.yPosition = y;
program = new Program();
program.setTaskAt(new Vector2(0, 0), new TaskGive());
program.setTaskAt(new Vector2(0, 1), new TaskGive());
program.setTaskAt(new Vector2(0, 2), new TaskGive());
program.setTaskAt(new Vector2(0, 3), new TaskGive());
program.init(null);
}
public void setProgram(IProgram program)
{
this.program = program;
}
@Override
public void scroll(int amount)
{
this.scroll += amount;
}
@Override
public void setScroll(int length)
{
this.scroll = length;
}
@Override
public int getScroll()
{
return this.scroll;
}
public void drawConsole(FontRenderer fontRenderer)
{
int spacing = 10;
int color = 14737632;
GL11.glPushMatrix();
float scale = 0.92f;
GL11.glScalef(scale, scale, scale);
// Draws each line
for (int i = 0; i < 4; i++)
{
int currentLine = i + this.scroll;
if (currentLine < this.program.getSize().intY() && currentLine >= 0)
{
ITask task = this.program.getTaskAt(new Vector2(0, currentLine));
if (task != null)
{
if (task instanceof IRedirectTask && !((IRedirectTask) task).render())
{
continue;
}
int xx = 50;
int yy = 39;
int uu = 0;
int vv = 0;
switch (task.getType())
{
case DATA:
break;
case PROCESS:
break;
case DEFINEDPROCESS:
xx = 50;
yy = 39;
uu = 0;
vv = 39;
break;
case DECISION:
xx = 50;
yy = 50;
uu = 50;
vv = 0;
break;
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.TEXTURE_PROCESS);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(this.xPosition + xx / 2, this.yPosition + (yy * i), uu, vv, xx, yy);
this.drawCenteredString(fontRenderer, task.getMethodName(), this.xPosition + xx, this.yPosition + (yy * i), -6250336);
}
}
}
GL11.glPopMatrix();
}
}

View file

@ -22,7 +22,9 @@ public class CommonProxy implements IGuiHandler
{
public static final int GUI_IMPRINTER = 1;
public static final int GUI_ENCODER = 2;
public static final int GUI_PROCESSOR = 3;
public static final int GUI_ENCODER_CODE = 3;
public static final int GUI_ENCODER_HELP = 4;
public static final int GUI_PROCESSOR = 5;
public void preInit()
{
@ -109,8 +111,10 @@ public class CommonProxy implements IGuiHandler
case GUI_ENCODER:
{
if (tileEntity != null && tileEntity instanceof TileEntityEncoder)
{
return new ContainerEncoder(player.inventory, (TileEntityEncoder) tileEntity);
}
}
case GUI_PROCESSOR:
{
return new ContainerProcessor(player.inventory, (TileEntityProcessor) tileEntity);

View file

@ -105,6 +105,7 @@ public class Program implements IProgram
{
if (task != null)
{
task.setPosition(vector2);
if (task.getPosition().x > this.width)
{
this.width = (int) task.getPosition().x;
@ -329,4 +330,10 @@ public class Program implements IProgram
return program;
}
@Override
public Vector2 getSize()
{
return new Vector2(this.width, this.hight);
}
}

View file

@ -15,7 +15,7 @@ public abstract class TaskBaseProcess extends TaskBase implements IProcessTask
public TaskBaseProcess(String name)
{
super(name, TaskType.PROCESS);
super(name, TaskType.DEFINEDPROCESS);
this.ticks = 0;
}

View file

@ -13,30 +13,28 @@ public class ContainerEncoder extends Container
public static final int Y_OFFSET = 0;
private ItemStack[] containingItems = new ItemStack[1];
private InventoryPlayer inventoryPlayer;
private TileEntityEncoder tileEntity;
public ContainerEncoder(InventoryPlayer inventoryPlayer, TileEntityEncoder encoder)
{
this.inventoryPlayer = inventoryPlayer;
this.tileEntity = encoder;
// Disk
this.addSlotToContainer(new SlotRestricted(encoder, 0, 80, 24 + Y_OFFSET, new ItemStack(AssemblyLine.recipeLoader.itemDisk)));
int var3;
int row;
for (var3 = 0; var3 < 3; ++var3)
// Player Inventory
for (row = 0; row < 3; ++row)
{
for (int var4 = 0; var4 < 9; ++var4)
for (int slot = 0; slot < 9; ++slot)
{
this.addSlotToContainer(new Slot(inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 155 + var3 * 18 + Y_OFFSET));
this.addSlotToContainer(new Slot(inventoryPlayer, slot + row * 9 + 9, 8 + slot * 18, 97 + row * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
for (row = 0; row < 9; ++row)
{
this.addSlotToContainer(new Slot(inventoryPlayer, var3, 8 + var3 * 18, 213 + Y_OFFSET));
this.addSlotToContainer(new Slot(inventoryPlayer, row, 8 + row * 18, 155));
}
}

View file

@ -33,8 +33,10 @@ public class TileEntityEncoder extends TileEntityMachine implements ISidedInvent
{
super.onInventoryChanged();
if (watcher != null)
{
watcher.inventoryChanged();
}
}
@Override
public String getInvName()