package net.brokenmoon.afloydwiremod.gui; import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer; import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler; import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.src.*; public class GuiProgrammer extends GuiScrollable { private AbstractWireTileEntity wireEntity; @Override public void initGui() { //this.height - 240 is top //This.width / 2 int i = 0; this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "TRUE")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "FALSE")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "AND")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "NAND")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "OR")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "NOR")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "XOR")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "XNOR")); this.controlList.add(new GuiButtonExtended(i++, this.width - GuiButtonExtended.width * 2, "NOT")); i = 0; this.controlList.add(new GuiButtonExtended(i++, this.width, "Constant")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Increment")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Decrement")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Increment/Decrement")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Duplicate")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Addition")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Subtraction")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Multiplication")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Division")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Memory")); this.controlList.add(new GuiButtonExtended(i++, this.width, "Pulse")); i = 0; this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "==")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "!=")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, ">")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, ">=")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "<")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "<=")); this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "<=>")); } public GuiProgrammer(EntityPlayer player, ChipTileEntity wireEntity) { super.initGui(); this.player = player; this.wireEntity = wireEntity; } @Override protected void actionPerformed(GuiButton guibutton) { switch(guibutton.displayString){ case "Constant": this.setMode("constant"); break; case "Increment": this.setMode("inc"); break; case "Duplicate": this.setMode("dup"); break; case "Addition": this.setMode("add"); break; case "Subtraction": this.setMode("sub"); break; case "Multiplication": this.setMode("mult"); break; case "Division": this.setMode("div"); break; case "Decrement": this.setMode("dec"); break; case "Increment/Decrement": this.setMode("incdec"); break; case "Memory": this.setMode("mem"); break; case "TRUE": case "FALSE": case "NOT": case "AND": case "OR": case "XOR": case "NAND": case "NOR": case "XNOR": case "==": case "!=": case ">": case ">=": case "<": case "<=": case "<=>": case "Pulse": this.setMode(guibutton.displayString); break; } this.mc.displayGuiScreen(null); } public void setMode(String string){ if(this.player instanceof EntityClientPlayerMP){ NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue; netclienthandler.addToSendQueue(new WiremodProgrammerPacket(string, wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)); return; } ((ChipTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)).setMode(string); } }