Forgot the actual settingsgui

visibileWires
Astoria 2 years ago
parent dbdd7ba11b
commit e82bbd3b49

@ -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 + "";
}
}
Loading…
Cancel
Save