private void updateHeat(int delta) { if (textboxHeat != null) { int heat = 0; try { String value = textboxHeat.getText(); if (!"".equals(value)) heat = Integer.parseInt(value); } catch (NumberFormatException e) { // do nothing } heat += delta; if (heat < 0) heat = 0; if (heat >= 1000000) heat = 1000000; if (thermo.getHeatLevel().intValue() != heat) { thermo.setHeatLevel(heat); ((NetworkManager) IC2.network.get()).initiateClientTileEntityEvent(thermo, heat); } textboxHeat.setText(new Integer(heat).toString()); } }
@SuppressWarnings("unchecked") @Override public void initGui() { super.initGui(); buttonList.clear(); buttonList.add(new CompactButton(0, guiLeft + 47, guiTop + 20, 22, 12, "-1")); buttonList.add(new CompactButton(1, guiLeft + 47, guiTop + 31, 22, 12, "-10")); buttonList.add(new CompactButton(2, guiLeft + 12, guiTop + 20, 36, 12, "-100")); buttonList.add(new CompactButton(3, guiLeft + 12, guiTop + 31, 36, 12, "-1000")); buttonList.add(new CompactButton(4, guiLeft + 12, guiTop + 42, 57, 12, "-10000")); buttonList.add(new CompactButton(5, guiLeft + 122, guiTop + 20, 22, 12, "+1")); buttonList.add(new CompactButton(6, guiLeft + 122, guiTop + 31, 22, 12, "+10")); buttonList.add(new CompactButton(7, guiLeft + 143, guiTop + 20, 36, 12, "+100")); buttonList.add(new CompactButton(8, guiLeft + 143, guiTop + 31, 36, 12, "+1000")); buttonList.add(new CompactButton(9, guiLeft + 122, guiTop + 42, 57, 12, "+10000")); buttonList.add(new GuiThermoInvertRedstone(10, guiLeft + 70, guiTop + 38, thermo)); textboxHeat = new GuiTextField(fontRendererObj, 70, 21, 51, 12); textboxHeat.setFocused(true); textboxHeat.setText(thermo.getHeatLevel().toString()); }