Fix tooltip

This commit is contained in:
Raoul Van den Berge
2016-03-24 19:16:27 +01:00
parent 578e6da0a2
commit 8151065bb1

View File

@@ -62,6 +62,8 @@ public class GuiController extends GuiBase {
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
ItemStack hoveringMachineStack = null;
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
if (slot < controller.getMachines().size()) { if (slot < controller.getMachines().size()) {
TileMachine machine = controller.getMachines().get(slot); TileMachine machine = controller.getMachines().get(slot);
@@ -71,7 +73,7 @@ public class GuiController extends GuiBase {
ItemStack machineStack = new ItemStack(machineBlock, 1, machineBlock.getMetaFromState(machineState)); ItemStack machineStack = new ItemStack(machineBlock, 1, machineBlock.getMetaFromState(machineState));
if (inBounds(x, y, 16, 16, mouseX, mouseY)) { if (inBounds(x, y, 16, 16, mouseX, mouseY)) {
drawTooltip(mouseX, mouseY, machineStack); hoveringMachineStack = machineStack;
} }
drawItem(x, y, machineStack); drawItem(x, y, machineStack);
@@ -88,6 +90,10 @@ public class GuiController extends GuiBase {
slot++; slot++;
} }
if (hoveringMachineStack != null) {
drawTooltip(mouseX, mouseY, hoveringMachineStack);
}
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) { if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage()) + "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null))); drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage()) + "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
} }