Fixed textured rectangles in custom GUIs not being placed relative to the GUIs' position.

This commit is contained in:
luisc committed 2022-01-14 15:41:27 -06:00
1 parent b0da137db5
commit 2874643c84
2 files changed
+3 -3

No files matched your search

@@ -56,7 +56,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
boolean hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
mc.getTextureManager().bindTexture(this.texture);
this.drawTexturedModalRect(this.textureX, this.textureY, 0, 0, (int)(this.width*this.scale), (int)(this.height*this.scale));
this.drawTexturedModalRect(this.x + this.textureX, this.y + this.textureY, 0, 0, (int)(this.width*this.scale), (int)(this.height*this.scale));
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
this.parent.hoverText = this.hoverText;
@@ -22,12 +22,12 @@ public class ScriptGuiTexturedRect extends ScriptGuiComponent implements ITextur
this.scale = 1.0F;
this.setID(id);
this.setTexture(texture);
this.setPos(GuiCustom.guiLeft + x, GuiCustom.guiTop + y);
this.setPos(x, y);
this.setSize(width, height);
}
public ScriptGuiTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY) {
this(id, texture, GuiCustom.guiLeft + x, GuiCustom.guiTop + y, width, height);
this(id, texture, x, y, width, height);
this.setTextureOffset(textureX, textureY);
}