diff --git a/src/main/java/net/brokenmoon/afloydwiremod/WiremodConfig.java b/src/main/java/net/brokenmoon/afloydwiremod/WiremodConfig.java index 625d5e6..9d16513 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/WiremodConfig.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/WiremodConfig.java @@ -26,6 +26,7 @@ public class WiremodConfig { public int redsilicaID; public int dieID; public int dieOvercookedID; + public int scrollrate; public WiremodConfig(){ @@ -49,6 +50,8 @@ public class WiremodConfig { redsilicaID = toml.getLong("ids.item.redSilica", (long)911).intValue(); dieID = toml.getLong("ids.item.chipDie", (long)912).intValue(); dieOvercookedID = toml.getLong("ids.item.chipDieOvercooked", (long)913).intValue(); + //Various settings + scrollrate = toml.getLong("misc.scrollrate", (long)5).intValue(); } public static File getConfig() { diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiProgrammer.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiProgrammer.java index d509fc0..ca04dd1 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiProgrammer.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiProgrammer.java @@ -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) { diff --git a/src/main/resources/assets/afloydwiremod/config.toml b/src/main/resources/assets/afloydwiremod/config.toml index 90dc827..40b2c5b 100644 --- a/src/main/resources/assets/afloydwiremod/config.toml +++ b/src/main/resources/assets/afloydwiremod/config.toml @@ -20,4 +20,7 @@ wiring = 111 wiringGui = 112 wiringSettingsGui = 113 sync = 114 -chipSettingsGui = 115 \ No newline at end of file +chipSettingsGui = 115 + +[misc] +scrollrate = 5 \ No newline at end of file diff --git a/src/main/resources/assets/afloydwiremod/gui/programmer.ase b/src/main/resources/assets/afloydwiremod/gui/programmer.ase index 934d7c6..ef937a4 100644 Binary files a/src/main/resources/assets/afloydwiremod/gui/programmer.ase and b/src/main/resources/assets/afloydwiremod/gui/programmer.ase differ diff --git a/src/main/resources/assets/afloydwiremod/gui/programmer.png b/src/main/resources/assets/afloydwiremod/gui/programmer.png index 1f0764f..1099f79 100644 Binary files a/src/main/resources/assets/afloydwiremod/gui/programmer.png and b/src/main/resources/assets/afloydwiremod/gui/programmer.png differ