Fixed pass-through of mouse coordinates for gui tooltips. Closes #449

This commit is contained in:
SirSengir 2012-11-28 22:16:22 +01:00
parent cd49e61f57
commit e911404459
8 changed files with 11 additions and 34 deletions

View file

@ -52,7 +52,7 @@ public class GuiBuilder extends GuiAdvancedInterface {
if (builder.isBuildingBlueprint())
fontRenderer.drawString(StringUtil.localize("gui.needed"), 185, 7, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override

View file

@ -147,13 +147,13 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
GL11.glPopMatrix();
}
protected void drawForegroundSelection() {
protected void drawForegroundSelection(int mouseX, int mouseY) {
String s = "";
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
int position = getSlotAtLocation(lastX - cornerX, lastY - cornerY);
int position = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
if (position != -1) {
AdvancedSlot slot = slots[position];
@ -163,20 +163,9 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
}
if (s.length() > 0) {
int i2 = (lastX - cornerX);
int k2 = lastY - cornerY;
int i2 = (mouseX - cornerX);
int k2 = mouseY - cornerY;
drawCreativeTabHoveringText(s, i2, k2);
}
}
private int lastX = 0;
private int lastY = 0;
@Override
protected void mouseMovedOrUp(int i, int j, int k) {
super.mouseMovedOrUp(i, j, k);
lastX = i;
lastY = j;
}
}

View file

@ -238,7 +238,7 @@ public abstract class GuiBuildCraft extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
ledgerManager.drawLedgers(mouseX, mouseY);
ledgerManager.drawLedgers(par1, par2);
}
protected int getCenteredOffset(String string) {
@ -258,16 +258,4 @@ public abstract class GuiBuildCraft extends GuiContainer {
ledgerManager.handleMouseClicked(par1, par2, mouseButton);
}
// / MOUSE MOVEMENT
private int mouseX = 0;
private int mouseY = 0;
@Override
protected void mouseMovedOrUp(int i, int j, int k) {
super.mouseMovedOrUp(i, j, k);
mouseX = i;
mouseY = j;
}
}

View file

@ -49,7 +49,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
fontRenderer.drawString("<-", 106, 59, 0x404040);
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override

View file

@ -92,7 +92,7 @@ public class GuiAssemblyAdvancedWorkbench extends GuiAdvancedInterface {
String title = StringUtil.localize("tile.assemblyWorkbenchBlock");
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override

View file

@ -130,7 +130,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
String title = StringUtil.localize("tile.assemblyTableBlock");
fontRenderer.drawString(title, getCenteredOffset(title), 15, 0x404040);
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override

View file

@ -49,7 +49,7 @@ public class GuiDiamondPipe extends GuiAdvancedInterface {
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override

View file

@ -243,7 +243,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
fontRenderer.drawString(name, getCenteredOffset(name), 15, 0x404040);
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
drawForegroundSelection();
drawForegroundSelection(par1, par2);
}
@Override