From e82bbd3b49f7dfda141d7f94157cc63d7d9c22f5 Mon Sep 17 00:00:00 2001 From: Astoria Date: Sat, 1 Apr 2023 11:40:15 -0500 Subject: [PATCH] Forgot the actual settingsgui --- .../afloydwiremod/gui/GuiSettings.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java new file mode 100644 index 0000000..d9240c5 --- /dev/null +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java @@ -0,0 +1,55 @@ +package net.brokenmoon.afloydwiremod.gui; + +import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; +import net.brokenmoon.afloydwiremod.api.WireConnection; +import net.brokenmoon.afloydwiremod.item.ToolWiring; +import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; + +public class GuiSettings extends GuiScreen { + private AbstractWireTileEntity wireEntity; + @Override + public void initGui() { + //this.height - 240 is top + //This.width / 2 - 214 is left + //Inputs + if(wireEntity instanceof ChipTileEntity){ + if(((ChipTileEntity) wireEntity).mode.equals("constant")){ + initConst(); + } + } + + } + + public void initConst(){ + this.controlList.add(new GuiButton(1, this.width /2, this.height/2 - 20, "+")); + this.controlList.add(1,new GuiButton(0, this.width /2, this.height/2 , wireEntity.outputs[0].floatvalue + "")); + this.controlList.add(new GuiButton(2, this.width /2, this.height/2 + 20, "-")); + } + + public GuiSettings(EntityPlayer player, AbstractWireTileEntity wireEntity) { + super.initGui(); + this.wireEntity = wireEntity; + } + + @Override + protected void actionPerformed(GuiButton guiButton){ + if(wireEntity instanceof ChipTileEntity){ + if(((ChipTileEntity)wireEntity).mode.equals("constant")){ + constAction(guiButton); + } + } + } + + private void constAction(GuiButton guiButton) { + if(guiButton.id == 1){ + wireEntity.outputs[0].floatvalue++; + } + if(guiButton.id == 2){ + wireEntity.outputs[0].floatvalue--; + } + this.controlList.get(1).displayString = wireEntity.outputs[0].floatvalue + ""; + } +}