added getWidth() method to GuiString which returns the width of the drawn String (calculated using FontRenderer#getStringWidth())
This commit is contained in:
@@ -78,4 +78,13 @@ public class GuiString extends Gui implements GuiElement {
|
|||||||
public void setElementEnabled(boolean enabled) {
|
public void setElementEnabled(boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
try {
|
||||||
|
return Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.getContent.call());
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user