You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
5.2 KiB
Java
111 lines
5.2 KiB
Java
package net.brokenmoon.afloydwiremod.gui;
|
|
|
|
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
|
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
|
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, AbstractWireTileEntity wireEntity) {
|
|
super.initGui();
|
|
this.wireEntity = wireEntity;
|
|
}
|
|
|
|
@Override
|
|
protected void actionPerformed(GuiButton guibutton) {
|
|
if(wireEntity instanceof ChipTileEntity) {
|
|
switch(guibutton.displayString){
|
|
case "Constant":
|
|
((ChipTileEntity) wireEntity).setMode("constant");
|
|
break;
|
|
case "Increment":
|
|
((ChipTileEntity) wireEntity).setMode("inc");
|
|
break;
|
|
case "Duplicate":
|
|
((ChipTileEntity) wireEntity).setMode("dup");
|
|
break;
|
|
case "Addition":
|
|
((ChipTileEntity) wireEntity).setMode("add");
|
|
break;
|
|
case "Subtraction":
|
|
((ChipTileEntity) wireEntity).setMode("sub");
|
|
break;
|
|
case "Multiplication":
|
|
((ChipTileEntity) wireEntity).setMode("mult");
|
|
break;
|
|
case "Division":
|
|
((ChipTileEntity) wireEntity).setMode("div");
|
|
break;
|
|
case "Decrement":
|
|
((ChipTileEntity) wireEntity).setMode("dec");
|
|
break;
|
|
case "Increment/Decrement":
|
|
((ChipTileEntity) wireEntity).setMode("incdec");
|
|
break;
|
|
case "Memory":
|
|
((ChipTileEntity) wireEntity).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":
|
|
((ChipTileEntity) wireEntity).setMode(guibutton.displayString);
|
|
break;
|
|
}
|
|
}
|
|
this.mc.displayGuiScreen(null);
|
|
}
|
|
|
|
}
|