|
|
|
@ -1,51 +1,53 @@
|
|
|
|
|
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.*;
|
|
|
|
|
import org.lwjgl.input.Mouse;
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
|
|
public class GuiProgrammer extends GuiScrollable {
|
|
|
|
|
|
|
|
|
|
private AbstractWireTileEntity wireEntity;
|
|
|
|
|
|
|
|
|
|
public int xSize = 100;
|
|
|
|
|
public int ySize = 180;
|
|
|
|
|
private int slot = 0;
|
|
|
|
|
|
|
|
|
|
@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, "<=>"));
|
|
|
|
|
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, "<=>"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GuiProgrammer(EntityPlayer player, ChipTileEntity wireEntity) {
|
|
|
|
@ -119,4 +121,39 @@ public class GuiProgrammer extends GuiScrollable {
|
|
|
|
|
((ChipTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)).setMode(string);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void drawScreen(int x, int y, float renderPartialTicks){
|
|
|
|
|
this.drawDefaultBackground();
|
|
|
|
|
//Draw the overlay
|
|
|
|
|
this.drawGuiBackground(renderPartialTicks);
|
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
|
int k = (this.height - this.ySize) / 2;
|
|
|
|
|
int wheel = Mouse.getDWheel();
|
|
|
|
|
if(wheel > 0)
|
|
|
|
|
scroll++;
|
|
|
|
|
if (wheel < 0)
|
|
|
|
|
scroll--;
|
|
|
|
|
if(scroll > 0)
|
|
|
|
|
scroll = 0;
|
|
|
|
|
if(-scroll > slot - 16)
|
|
|
|
|
scroll = -(slot - 16);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void drawGuiBackground(float f) {
|
|
|
|
|
int guiTexture = this.mc.renderEngine.getTexture("/assets/afloydwiremod/gui/programmer.png");
|
|
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
|
this.mc.renderEngine.bindTexture(guiTexture);
|
|
|
|
|
int j = (this.width - this.xSize) / 2;
|
|
|
|
|
int k = (this.height - this.ySize) / 2;
|
|
|
|
|
this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|