use of net.geforcemods.securitycraft.gui.components.GuiItemButton in project SecurityCraft by Geforce132.
the class GuiCustomizeBlock method initGui.
@Override
public void initGui() {
super.initGui();
for (int i = 0; i < tileEntity.getNumberOfCustomizableOptions(); i++) {
descriptionButtons[i] = new GuiItemButton(i, guiLeft + 130, (guiTop + 10) + (i * 25), 20, 20, "", itemRender, new ItemStack(tileEntity.acceptedModules()[i].getItem()));
this.buttonList.add(descriptionButtons[i]);
this.hoverCheckers[i] = new HoverChecker(descriptionButtons[i], 20);
}
if (tileEntity.customOptions() != null) {
for (int i = 0; i < tileEntity.customOptions().length; i++) {
optionButtons[i] = new GuiButton(i, guiLeft + 178, (guiTop + 10) + (i * 25), 120, 20, getOptionButtonTitle(tileEntity.customOptions()[i]));
optionButtons[i].packedFGColour = tileEntity.customOptions()[i].toString().matches(tileEntity.customOptions()[i].getDefaultValue().toString()) ? 16777120 : 14737632;
this.buttonList.add(optionButtons[i]);
this.hoverCheckers[i + tileEntity.getNumberOfCustomizableOptions()] = new HoverChecker(optionButtons[i], 20);
}
}
}
use of net.geforcemods.securitycraft.gui.components.GuiItemButton in project SecurityCraft by Geforce132.
the class GuiCustomizeBlock method actionPerformed.
@Override
protected void actionPerformed(GuiButton guibutton) {
if (!(guibutton instanceof GuiItemButton)) {
Option<?> tempOption = tileEntity.customOptions()[guibutton.id];
tempOption.toggle();
guibutton.packedFGColour = tempOption.toString().matches(tempOption.getDefaultValue().toString()) ? 16777120 : 14737632;
guibutton.displayString = getOptionButtonTitle(tempOption);
mod_SecurityCraft.network.sendToServer(new PacketSToggleOption(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ(), guibutton.id));
}
}
Aggregations