|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package net.brokenmoon.afloydwiremod.gui;
|
|
|
|
|
|
|
|
|
|
import net.brokenmoon.afloydwiremod.WireMod;
|
|
|
|
|
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
|
|
|
|
import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket;
|
|
|
|
|
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
|
|
|
@ -14,40 +15,40 @@ public class GuiProgrammer extends GuiScrollable {
|
|
|
|
|
|
|
|
|
|
public int xSize = 100;
|
|
|
|
|
public int ySize = 180;
|
|
|
|
|
private int slot = 0;
|
|
|
|
|
private int numOfElements = 0;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void initGui() {
|
|
|
|
|
//this.height - 240 is top
|
|
|
|
|
//This.width / 2
|
|
|
|
|
slot = 0;
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Constant"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Increment"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Decrement"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Increment/Decrement"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Duplicate"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Addition"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Subtraction"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Multiplication"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Division"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Memory"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "Pulse"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "TRUE"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "FALSE"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "AND"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "NAND"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "OR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "NOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "XOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "XNOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "NOT"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "=="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "!="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, ">"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, ">="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "<"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "<="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(slot++, this.width, "<=>"));
|
|
|
|
|
numOfElements = 0;
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Constant"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Increment"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Decrement"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Counter"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Duplicate"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Addition"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Subtraction"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Multiplication"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Division"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Memory"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Pulse"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "TRUE"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "FALSE"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "AND"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NAND"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "OR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "XOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "XNOR"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NOT"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "=="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "!="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, ">"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, ">="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<"));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<="));
|
|
|
|
|
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<=>"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GuiProgrammer(EntityPlayer player, ChipTileEntity wireEntity) {
|
|
|
|
@ -83,7 +84,7 @@ public class GuiProgrammer extends GuiScrollable {
|
|
|
|
|
case "Decrement":
|
|
|
|
|
this.setMode("dec");
|
|
|
|
|
break;
|
|
|
|
|
case "Increment/Decrement":
|
|
|
|
|
case "Counter":
|
|
|
|
|
this.setMode("incdec");
|
|
|
|
|
break;
|
|
|
|
|
case "Memory":
|
|
|
|
@ -129,23 +130,24 @@ public class GuiProgrammer extends GuiScrollable {
|
|
|
|
|
this.drawGuiBackground(renderPartialTicks);
|
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
|
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
|
|
|
|
GL11.glScissor((width / 2 - 60) * this.mc.resolution.scale, (height / 2 - 80) * this.mc.resolution.scale, 120 * this.mc.resolution.scale, 160 * this.mc.resolution.scale);
|
|
|
|
|
int k = (this.height - this.ySize) / 2;
|
|
|
|
|
int wheel = Mouse.getDWheel();
|
|
|
|
|
if(wheel > 0)
|
|
|
|
|
scroll++;
|
|
|
|
|
scroll += WireMod.config.scrollrate;
|
|
|
|
|
if (wheel < 0)
|
|
|
|
|
scroll--;
|
|
|
|
|
scroll -= WireMod.config.scrollrate;
|
|
|
|
|
if(scroll > 0)
|
|
|
|
|
scroll = 0;
|
|
|
|
|
if(-scroll > slot - 16)
|
|
|
|
|
scroll = -(slot - 16);
|
|
|
|
|
if(-scroll > (numOfElements - 16) * GuiButtonExtended.height)
|
|
|
|
|
scroll = -((numOfElements - 16) * GuiButtonExtended.height);
|
|
|
|
|
for (int i = 0; i < this.controlList.size(); ++i) {
|
|
|
|
|
GuiButtonExtended guibutton = (GuiButtonExtended)this.controlList.get(i);
|
|
|
|
|
guibutton.yPosition = k + (guibutton.height * (guibutton.id + 1) + scroll * GuiButtonExtended.height);
|
|
|
|
|
if(guibutton.yPosition > k && guibutton.yPosition < k + 170){
|
|
|
|
|
guibutton.drawButton(this.mc, x, y);
|
|
|
|
|
}
|
|
|
|
|
guibutton.yPosition = k + (guibutton.height * (guibutton.id + 1) + scroll);
|
|
|
|
|
guibutton.drawButton(this.mc, x, y);
|
|
|
|
|
}
|
|
|
|
|
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void drawGuiBackground(float f) {
|
|
|
|
|