Skip to content

Commit

Permalink
- Update energy cells in machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunnky committed Oct 3, 2024
1 parent 28ce295 commit 01f2b1d
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,14 @@ public int getTickRate() {
return 1;
}

public void updateEnergyCellInGUI() {
if (installedCell != null) {
ItemStack energyCellItem = installedCell.toItemStack();
STBUtil.levelToDurability(energyCellItem, (int) installedCell.getCharge(), installedCell.getMaxCharge());
getGUI().getInventory().setItem(getEnergyCellSlot(), energyCellItem);
}
}

@Override
public void onServerTick() {
if (getTicksLived() % SensibleToolboxPlugin.getInstance().getEnergyNetManager().getTickRate() == 0) {
Expand All @@ -1084,6 +1092,7 @@ public void onServerTick() {

if (chargeMeterId >= 0) {
getGUI().getMonitor(chargeMeterId).doRepaint();

}
}
}
Expand All @@ -1097,6 +1106,7 @@ public void onServerTick() {
needToProcessUpgrades = false;
}

updateEnergyCellInGUI();
super.onServerTick();
}

Expand Down

0 comments on commit 01f2b1d

Please sign in to comment.