diff --git a/src/main/java/binnie/core/gui/IWidget.java b/src/main/java/binnie/core/gui/IWidget.java index 410a5c2b..5a57b855 100644 --- a/src/main/java/binnie/core/gui/IWidget.java +++ b/src/main/java/binnie/core/gui/IWidget.java @@ -45,8 +45,6 @@ public interface IWidget { Area getArea(); - Area area(); - Point getMousePosition(); Point getRelativeMousePosition(); @@ -89,7 +87,7 @@ public interface IWidget { boolean canFocus(); - IWidget addWidget(final IWidget p0); + IWidget addChild(final IWidget p0); List getChildren(); @@ -138,9 +136,9 @@ public interface IWidget { int getYPos(); - int width(); + int getWidth(); - int height(); + int getHeight(); @SideOnly(Side.CLIENT) void onRender(final RenderStage stage, int guiWidth, int guiHeight); diff --git a/src/main/java/binnie/core/gui/Widget.java b/src/main/java/binnie/core/gui/Widget.java index c9ae4f4f..03142642 100644 --- a/src/main/java/binnie/core/gui/Widget.java +++ b/src/main/java/binnie/core/gui/Widget.java @@ -45,7 +45,7 @@ public class Widget implements IWidget { this.visible = true; this.parent = parent; if (parent != null) { - parent.addWidget(this); + parent.addChild(this); } } @@ -96,8 +96,8 @@ public class Widget implements IWidget { } @Override - public final IWidget addWidget(final IWidget widget) { - if (this.children.size() != 0 && this.children.get(this.children.size() - 1).hasAttribute(Attribute.ALWAYS_ON_TOP)) { + public final IWidget addChild(final IWidget widget) { + if (hasChildren() && this.children.get(this.children.size() - 1).hasAttribute(Attribute.ALWAYS_ON_TOP)) { this.children.add(this.children.size() - 1, widget); } else { this.children.add(widget); @@ -141,11 +141,6 @@ public class Widget implements IWidget { return this.size; } - @Override - public final Area area() { - return this.getArea(); - } - @Override public final void setPosition(final Point vector) { if (!vector.equals(this.position)) { @@ -526,12 +521,12 @@ public class Widget implements IWidget { } @Override - public int width() { + public int getWidth() { return this.size().x(); } @Override - public int height() { + public int getHeight() { return this.size().y(); } diff --git a/src/main/java/binnie/core/gui/controls/ControlTextEdit.java b/src/main/java/binnie/core/gui/controls/ControlTextEdit.java index ec2492c2..17d8f6bb 100644 --- a/src/main/java/binnie/core/gui/controls/ControlTextEdit.java +++ b/src/main/java/binnie/core/gui/controls/ControlTextEdit.java @@ -88,10 +88,10 @@ public class ControlTextEdit extends Control implements IControlValue { } protected void renderTextField() { - this.field.width = this.width(); - this.field.height = this.height(); - this.field.xPosition = (int) ((this.height() - 8.0f) / 2.0f); - this.field.yPosition = (int) ((this.height() - 8.0f) / 2.0f); + this.field.width = this.getWidth(); + this.field.height = this.getHeight(); + this.field.xPosition = (int) ((this.getHeight() - 8.0f) / 2.0f); + this.field.yPosition = (int) ((this.getHeight() - 8.0f) / 2.0f); this.field.drawTextBox(); } } diff --git a/src/main/java/binnie/core/gui/controls/listbox/ControlList.java b/src/main/java/binnie/core/gui/controls/listbox/ControlList.java index 821fe0bb..1c4584b2 100644 --- a/src/main/java/binnie/core/gui/controls/listbox/ControlList.java +++ b/src/main/java/binnie/core/gui/controls/listbox/ControlList.java @@ -48,7 +48,7 @@ public class ControlList extends Control implements IControlValue { this.value = value; if (this.optionWidgets.containsKey(value)) { final IWidget child = this.optionWidgets.get(value); - this.parent.ensureVisible(child.getYPos(), child.getYPos() + child.height(), this.height()); + this.parent.ensureVisible(child.getYPos(), child.getYPos() + child.getHeight(), this.getHeight()); } this.parent.callEvent(new EventValueChanged(this.parent, value)); } diff --git a/src/main/java/binnie/core/gui/controls/listbox/ControlListBox.java b/src/main/java/binnie/core/gui/controls/listbox/ControlListBox.java index 76d7105f..ddb68d21 100644 --- a/src/main/java/binnie/core/gui/controls/listbox/ControlListBox.java +++ b/src/main/java/binnie/core/gui/controls/listbox/ControlListBox.java @@ -17,7 +17,7 @@ public class ControlListBox extends ControlScrollableContent> public void initialise() { ControlList content = this.getContent(); T defaultValue = content == null ? null : content.getDefaultValue(); - ControlList child = new ControlList<>(this, 1, 1, this.width() - 2 - this.scrollBarSize, this.height() - 2, defaultValue); + ControlList child = new ControlList<>(this, 1, 1, this.getWidth() - 2 - this.scrollBarSize, this.getHeight() - 2, defaultValue); this.setScrollableContent(child); this.addEventHandler(new EventKey.Down.Handler() { @Override diff --git a/src/main/java/binnie/core/gui/controls/page/ControlPage.java b/src/main/java/binnie/core/gui/controls/page/ControlPage.java index d2739037..c22e4525 100644 --- a/src/main/java/binnie/core/gui/controls/page/ControlPage.java +++ b/src/main/java/binnie/core/gui/controls/page/ControlPage.java @@ -8,7 +8,7 @@ public class ControlPage extends Control implements IControlValue { private T value; public ControlPage(final IWidget parent, final T value) { - this(parent, 0, 0, parent.width(), parent.height(), value); + this(parent, 0, 0, parent.getWidth(), parent.getHeight(), value); } public ControlPage(final IWidget parent, final int x, final int y, final int w, final int h, final T value) { diff --git a/src/main/java/binnie/core/gui/controls/scroll/ControlScrollBar.java b/src/main/java/binnie/core/gui/controls/scroll/ControlScrollBar.java index d577c284..bef41eb3 100644 --- a/src/main/java/binnie/core/gui/controls/scroll/ControlScrollBar.java +++ b/src/main/java/binnie/core/gui/controls/scroll/ControlScrollBar.java @@ -25,7 +25,7 @@ public class ControlScrollBar extends Control { this.addSelfEventHandler(new EventMouse.Drag.Handler() { @Override public void onEvent(final EventMouse.Drag event) { - ControlScrollBar.this.scrollable.movePercentage(event.getDy() / (float) (ControlScrollBar.this.height() - ControlScrollBar.this.getBarHeight())); + ControlScrollBar.this.scrollable.movePercentage(event.getDy() / (float) (ControlScrollBar.this.getHeight() - ControlScrollBar.this.getBarHeight())); } }); this.addSelfEventHandler(new EventMouse.Down.Handler() { @@ -35,7 +35,7 @@ public class ControlScrollBar extends Control { final float percentageIndex = ControlScrollBar.this.scrollable.getPercentageIndex(); final float minPercent = (1.0f - shownPercentage) * percentageIndex; final float maxPercent = minPercent + shownPercentage; - float clickedPercentage = (float)ControlScrollBar.this.getRelativeMousePosition().y() / (ControlScrollBar.this.height() - 2.0f); + float clickedPercentage = (float)ControlScrollBar.this.getRelativeMousePosition().y() / (ControlScrollBar.this.getHeight() - 2.0f); clickedPercentage = Math.max(Math.min(clickedPercentage, 1.0f), 0.0f); if (clickedPercentage > maxPercent) { ControlScrollBar.this.scrollable.setPercentageIndex((clickedPercentage - shownPercentage) / (1.0f - shownPercentage)); @@ -57,7 +57,7 @@ public class ControlScrollBar extends Control { } public int getBarHeight() { - return Math.round(this.height() * this.scrollable.getPercentageShown()); + return Math.round(this.getHeight() * this.scrollable.getPercentageShown()); } protected Area getRenderArea() { @@ -65,7 +65,7 @@ public class ControlScrollBar extends Control { if (height < 6) { height = 6; } - final int yOffset = Math.round((this.height() - this.getBarHeight()) * this.scrollable.getPercentageIndex()); + final int yOffset = Math.round((this.getHeight() - this.getBarHeight()) * this.scrollable.getPercentageIndex()); return new Area(0, yOffset, this.getSize().x(), height); } diff --git a/src/main/java/binnie/core/gui/database/WindowAbstractDatabase.java b/src/main/java/binnie/core/gui/database/WindowAbstractDatabase.java index d7e392fe..eb118916 100644 --- a/src/main/java/binnie/core/gui/database/WindowAbstractDatabase.java +++ b/src/main/java/binnie/core/gui/database/WindowAbstractDatabase.java @@ -215,7 +215,7 @@ public abstract class WindowAbstractDatabase extends Window { public ModeWidgets(final IDatabaseMode mode, final WindowAbstractDatabase database) { this.database = database; this.modePage = new ControlPage<>(database.modePages, 0, 0, database.getSize().x(), database.getSize().y(), mode); - final Area listBoxArea = database.panelSearch.area().inset(2); + final Area listBoxArea = database.panelSearch.getArea().inset(2); this.createListBox(listBoxArea); CraftGUIUtil.alignToWidget(this.listBox, database.panelSearch); CraftGUIUtil.moveWidget(this.listBox, new Point(2, 2)); diff --git a/src/main/java/binnie/core/gui/fieldkit/WindowFieldKit.java b/src/main/java/binnie/core/gui/fieldkit/WindowFieldKit.java index 24443d45..019da62c 100644 --- a/src/main/java/binnie/core/gui/fieldkit/WindowFieldKit.java +++ b/src/main/java/binnie/core/gui/fieldkit/WindowFieldKit.java @@ -103,7 +103,7 @@ public class WindowFieldKit extends Window { new ControlSlot.Builder(this, handGlass.x() + 54, handGlass.y() + 26).assign(InventoryType.Window, 0); new ControlSlot.Builder(this, 208, 8).assign(InventoryType.Window, 1); (this.text = new ControlText(this, new Point(232, 13), I18N.localise("binniecore.gui.fieldkit.paper"))).setColor(2236962); - (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962); + (this.text = new ControlText(this, new Area(0, 120, this.getWidth(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962); this.chromo = new ControlChromosome(this, 150, 24); this.addEventHandler(new EventValueChanged.Handler() { @Override diff --git a/src/main/java/binnie/core/gui/minecraft/Dialog.java b/src/main/java/binnie/core/gui/minecraft/Dialog.java index 72538fa3..920fde7d 100644 --- a/src/main/java/binnie/core/gui/minecraft/Dialog.java +++ b/src/main/java/binnie/core/gui/minecraft/Dialog.java @@ -16,7 +16,7 @@ import binnie.core.gui.resource.minecraft.CraftGUITexture; @SideOnly(Side.CLIENT) public abstract class Dialog extends Control { public Dialog(final IWidget parent, final int w, final int h) { - super(parent, (parent.width() - w) / 2, (parent.height() - h) / 2, w, h); + super(parent, (parent.getWidth() - w) / 2, (parent.getHeight() - h) / 2, w, h); this.addAttribute(Attribute.MOUSE_OVER); this.addAttribute(Attribute.ALWAYS_ON_TOP); this.addAttribute(Attribute.BLOCK_TOOLTIP); diff --git a/src/main/java/binnie/core/gui/minecraft/Window.java b/src/main/java/binnie/core/gui/minecraft/Window.java index 8361a75e..b08277aa 100644 --- a/src/main/java/binnie/core/gui/minecraft/Window.java +++ b/src/main/java/binnie/core/gui/minecraft/Window.java @@ -103,7 +103,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG if (Window.this.isClient()) { Window.this.getGui().resize(Window.this.getSize()); if (Window.this.title != null) { - Window.this.title.setSize(new Point(Window.this.width(), Window.this.title.height())); + Window.this.title.setSize(new Point(Window.this.getWidth(), Window.this.title.getHeight())); } } } @@ -294,14 +294,14 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG @Override public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) { if (name.equals("username")) { - final int w = this.width(); + final int w = this.getWidth(); final int titleButtonRight = this.titleButtonRight + 16; this.titleButtonRight = titleButtonRight; final ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8, nbt.getString("username")); this.titleButtonRight += 6; } if (name.equals("power-system")) { - final int w2 = this.width(); + final int w2 = this.getWidth(); final int titleButtonRight2 = this.titleButtonRight + 16; this.titleButtonRight = titleButtonRight2; final ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8, PowerSystem.get(nbt.getByte("system"))); diff --git a/src/main/java/binnie/core/gui/minecraft/control/ControlSlide.java b/src/main/java/binnie/core/gui/minecraft/control/ControlSlide.java index f29292ba..b87bf018 100644 --- a/src/main/java/binnie/core/gui/minecraft/control/ControlSlide.java +++ b/src/main/java/binnie/core/gui/minecraft/control/ControlSlide.java @@ -68,7 +68,7 @@ public class ControlSlide extends Control { } CraftGUI.RENDER.texture(CraftGUITexture.Window, this.getArea()); final Object slideTexture = (this.anchor == Position.BOTTOM) ? CraftGUITexture.SlideDown : ((this.anchor == Position.Top) ? CraftGUITexture.SlideUp : ((this.anchor == Position.LEFT) ? CraftGUITexture.SlideLeft : CraftGUITexture.SlideRight)); - CraftGUI.RENDER.texture(slideTexture, new Point((this.anchor.x() + 1) * this.width() / 2 - 8, (this.anchor.y() + 1) * this.height() / 2 - 8)); + CraftGUI.RENDER.texture(slideTexture, new Point((this.anchor.x() + 1) * this.getWidth() / 2 - 8, (this.anchor.y() + 1) * this.getHeight() / 2 - 8)); } public boolean isSlideActive() { diff --git a/src/main/java/binnie/core/machines/storage/WindowCompartment.java b/src/main/java/binnie/core/machines/storage/WindowCompartment.java index 9c2a735f..e96640c2 100644 --- a/src/main/java/binnie/core/machines/storage/WindowCompartment.java +++ b/src/main/java/binnie/core/machines/storage/WindowCompartment.java @@ -155,7 +155,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh int i = 0; for (int p2 = 0; p2 < inv.getTabNumber(); ++p2) { final ControlPage thisPage = page[p2]; - final Panel panel = new Panel(thisPage, 0, 0, thisPage.width(), thisPage.height(), MinecraftGUI.PanelType.Black) { + final Panel panel = new Panel(thisPage, 0, 0, thisPage.getWidth(), thisPage.getHeight(), MinecraftGUI.PanelType.Black) { @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { @@ -214,8 +214,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh x += 24; } x += 16; - this.setSize(new Point(Math.max(32 + compartmentWidth, 252), this.height())); - controlCompartment.setPosition(new Point((this.width() - controlCompartment.width()) / 2, controlCompartment.getYPos())); + this.setSize(new Point(Math.max(32 + compartmentWidth, 252), this.getHeight())); + controlCompartment.setPosition(new Point((this.getWidth() - controlCompartment.getWidth()) / 2, controlCompartment.getYPos())); final ControlPlayerInventory invent = new ControlPlayerInventory(this, true); final ControlSlide slide = new ControlSlide(this, 0, 134, 136, 92, Position.LEFT); slide.setLabel("Tab Properties"); diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java index b85971bb..8653c751 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java @@ -53,9 +53,9 @@ public class AnalystPageBehaviour extends ControlAnalystPage { ? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect.getAlleleName()) : effectDesc; - new ControlText(this, new Area(4, y, width() - 8, 0), loc, TextJustification.TOP_CENTER) + new ControlText(this, new Area(4, y, getWidth() - 8, 0), loc, TextJustification.TOP_CENTER) .setColor(getColor()); - y += (int) (CraftGUI.RENDER.textHeight(loc, width() - 8) + 1.0f); + y += (int) (CraftGUI.RENDER.textHeight(loc, getWidth() - 8) + 1.0f); new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".withinBlocks", (int) (t.getX() / 2.0f))) .setColor(getColor()); @@ -88,7 +88,7 @@ public class AnalystPageBehaviour extends ControlAnalystPage { ? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect2.getAlleleName()) : effectDesc2; - new ControlText(this, new Area(4, y, width() - 8, 0), loc2, TextJustification.TOP_CENTER) + new ControlText(this, new Area(4, y, getWidth() - 8, 0), loc2, TextJustification.TOP_CENTER) .setColor(getColor()); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java index 6ded7059..bf492f29 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java @@ -39,58 +39,58 @@ public class AnalystPageBiology extends ControlAnalystPage { if (ind instanceof IBee) { IBee bee = (IBee) ind; if (bee.getGenome().getNeverSleeps()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconAllDay) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay")); } else if (bee.getGenome().getPrimary().isNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconNight) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night")); } else { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconDaytime) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day")); } if (!bee.getGenome().getToleratesRain()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain")); } if (bee.getGenome().getCaveDwelling()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoSky) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoSky) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".underground")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconSky) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 48, y, ModuleItems.iconSky) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notUnderground")); } y += 30; } else if (ind instanceof IButterfly) { IButterfly moth = (IButterfly) ind; if (moth.getGenome().getNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconAllDay) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay")); } else if (moth.getGenome().getPrimary().isNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconNight) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night")); } else { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime) + new ControlIconDisplay(this, (getWidth() - 64) / 2, y, ModuleItems.iconDaytime) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day")); } if (!moth.getGenome().getTolerantFlyer()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain")); } if (moth.getGenome().getFireResist()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoFire) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoFire) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".nonflammable")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconFire) + new ControlIconDisplay(this, (getWidth() - 64) / 2 + 48, y, ModuleItems.iconFire) .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flammable")); } y += 30; @@ -230,7 +230,7 @@ public class AnalystPageBiology extends ControlAnalystPage { .setColor(getColor()); y += 22; } - setSize(new Point(width(), y)); + setSize(new Point(getWidth(), y)); } private String getMCDayString(float time) { diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDatabase.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDatabase.java index fe4525dc..7d2a1113 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDatabase.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDatabase.java @@ -43,7 +43,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlTextEdit(this, 20, y, width() - 40, 16) { + new ControlTextEdit(this, 20, y, getWidth() - 40, 16) { @Override public void onTextEdit(String value) { Collection options = new ArrayList<>(); @@ -73,7 +73,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { } }; y += 22; - new Panel(this, 3, y - 1, width() - 6, height() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColor(getColor()); + new Panel(this, 3, y - 1, getWidth() - 6, getHeight() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColor(getColor()); boolean textView = false; Collection options = getSpecies(system); for (IAlleleSpecies species : options) { @@ -84,7 +84,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION)); } if (textView) { - scroll = new ControlListBox(this, 4, y, width() - 8, height() - y - 8 - 20, 0) { + scroll = new ControlListBox(this, 4, y, getWidth() - 8, getHeight() - y - 8 - 20, 0) { @Override public void initialise() { super.initialise(); @@ -93,7 +93,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override public IWidget createOption(IAlleleSpecies v, int y) { - return new Control(getContent(), 0, y, width(), 12) { + return new Control(getContent(), 0, y, getWidth(), 12) { IAlleleSpecies value = v; @Override @@ -105,10 +105,10 @@ public class AnalystPageDatabase extends ControlAnalystPage { } }; } else { - scroll = new ControlScrollableContent(this, 4, y, width() - 8, height() - y - 8, 0); + scroll = new ControlScrollableContent(this, 4, y, getWidth() - 8, getHeight() - y - 8, 0); scroll.setScrollableContent(getItemScrollList(system, options)); } - new ControlScrollBar(this, scroll.getXPos() + scroll.width() - 6, scroll.getYPos() + 3, 3, scroll.height() - 6, scroll) { + new ControlScrollBar(this, scroll.getXPos() + scroll.getWidth() - 6, scroll.getYPos() + 3, 3, scroll.getHeight() - 6, scroll) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -135,11 +135,11 @@ public class AnalystPageDatabase extends ControlAnalystPage { } private IWidget getItemScrollList(BreedingSystem system, Collection options) { - return new Control(scroll, 0, 0, scroll.width(), scroll.height()) { + return new Control(scroll, 0, 0, scroll.getWidth(), scroll.getHeight()) { @Override public void initialise() { - int maxBiomePerLine = (width() - 4 + 2) / 18; - int biomeListX = -6 + (width() - (maxBiomePerLine * 18 - 2)) / 2; + int maxBiomePerLine = (getWidth() - 4 + 2) / 18; + int biomeListX = -6 + (getWidth() - (maxBiomePerLine * 18 - 2)) / 2; int dx = 0; int dy = 0; for (IAlleleSpecies species : options) { @@ -179,7 +179,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { dy += 18; } } - setSize(new Point(width(), 4 + dy + 18)); + setSize(new Point(getWidth(), 4 + dy + 18)); } }; } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java index b44fd344..8a92f3e5 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java @@ -61,16 +61,16 @@ public class AnalystPageDescription extends ControlAnalystPage { y += 20; String discovered = I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".discovered") + " " + TextFormatting.BOLD + authority + TextFormatting.RESET; new ControlTextCentered(this, y, discovered).setColor(getColor()); - y += (int) (3.0f + CraftGUI.RENDER.textHeight(discovered, width())); + y += (int) (3.0f + CraftGUI.RENDER.textHeight(discovered, getWidth())); new ControlTextCentered(this, y, I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".complexity") + ": " + species.getComplexity()).setColor(getColor()); y += 26; - ControlText descText = new ControlText(this, new Area(8, y, width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); - IWidget signatureText = new ControlText(this, new Area(8, y, width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); + ControlText descText = new ControlText(this, new Area(8, y, getWidth() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); + IWidget signatureText = new ControlText(this, new Area(8, y, getWidth() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); descText.setColor(getColor()); signatureText.setColor(getColor()); int descHeight = CraftGUI.RENDER.textHeight(descText.getValue(), descText.getSize().x()); signatureText.setPosition(new Point(this.getPosition().x(), descText.getPosition().y() + descHeight + 10)); - setSize(new Point(width(), 20 + signatureText.getYPos())); + setSize(new Point(getWidth(), 20 + signatureText.getYPos())); } @Override diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java index f0cb6c37..479e38e6 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java @@ -33,7 +33,7 @@ public class AnalystPageGenome extends ControlAnalystPage { this.active = active; setColor(26265); int y = 4; - int width = width(); + int width = getWidth(); int center = width / 2; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java index 80ce6cc2..8c1d4f3e 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java @@ -24,8 +24,8 @@ public class AnalystPageKaryogram extends ControlAnalystPage { y += 8; ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); BreedingSystem system = Binnie.GENETICS.getSystem(root); - int maxBiomePerLine = (int) ((width() + 4.0f - 16.0f) / 22.0f); - int karygramX = (width() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; + int maxBiomePerLine = (int) ((getWidth() + 4.0f - 16.0f) / 22.0f); + int karygramX = (getWidth() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; int dx = 0; int dy = 0; int rem = system.getActiveKaryotype().size(); diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java index d01522b6..30f4aac1 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java @@ -101,7 +101,7 @@ public class AnalystPageMutations extends ControlAnalystPage { } else if (hive != null) { new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.natural")).setColor(getColor()); y += 10; - ControlItemDisplay display = new ControlItemDisplay(this, (width() - 16) / 2, y); + ControlItemDisplay display = new ControlItemDisplay(this, (getWidth() - 16) / 2, y); if (speciesCurrent == ForestryAllele.BeeSpecies.Steadfast.getAllele()) { display.addTooltip(I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.dungeon")); } else { @@ -111,11 +111,11 @@ public class AnalystPageMutations extends ControlAnalystPage { y += 24; } } - int ox = (width() - 88 - 8) / 2; + int ox = (getWidth() - 88 - 8) / 2; int dx = 0; if (!resultant.isEmpty()) { if (resultant.size() == 1) { - ox = (width() - 44) / 2; + ox = (getWidth() - 44) / 2; } new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".resultant")).setColor(getColor()); y += 10; @@ -168,11 +168,11 @@ public class AnalystPageMutations extends ControlAnalystPage { } y += 10; } - ox = (width() - 88 - 8) / 2; + ox = (getWidth() - 88 - 8) / 2; dx = 0; if (!further.isEmpty()) { if (further.size() == 1) { - ox = (width() - 44) / 2; + ox = (getWidth() - 44) / 2; } new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".further")).setColor(getColor()); y += 10; @@ -228,7 +228,7 @@ public class AnalystPageMutations extends ControlAnalystPage { } } y += 8; - setSize(new Point(width(), y)); + setSize(new Point(getWidth(), y)); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageProduce.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageProduce.java index 9a637dc3..524ed954 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageProduce.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageProduce.java @@ -199,8 +199,8 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { protected int getRefined(String string, int y, Collection products) { new ControlTextCentered(this, y, string).setColor(getColor()); y += 10; - int maxBiomePerLine = (width() + 2 - 16) / 18; - int biomeListX = (width() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (getWidth() + 2 - 16) / 18; + int biomeListX = (getWidth() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; for (ItemStack soilStack : products) { diff --git a/src/main/java/binnie/genetics/gui/analyst/ControlToleranceBar.java b/src/main/java/binnie/genetics/gui/analyst/ControlToleranceBar.java index 43cc88b5..b746817c 100644 --- a/src/main/java/binnie/genetics/gui/analyst/ControlToleranceBar.java +++ b/src/main/java/binnie/genetics/gui/analyst/ControlToleranceBar.java @@ -60,7 +60,7 @@ public abstract class ControlToleranceBar> extends Control imp for (T value : fullSet) { int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(value); Border inset = new Border(tolerated.contains(value) ? 1 : 3); - RenderUtil.drawGradientRect(new Area(w * t, 0, w, height()).inset(inset), col, col); + RenderUtil.drawGradientRect(new Area(w * t, 0, w, getHeight()).inset(inset), col, col); ++t; } } diff --git a/src/main/java/binnie/genetics/gui/analyst/WindowAnalyst.java b/src/main/java/binnie/genetics/gui/analyst/WindowAnalyst.java index 98b5c62f..3ab1e030 100644 --- a/src/main/java/binnie/genetics/gui/analyst/WindowAnalyst.java +++ b/src/main/java/binnie/genetics/gui/analyst/WindowAnalyst.java @@ -197,7 +197,7 @@ public class WindowAnalyst extends Window { x += 26; setupValidators(); } - tabBar = new Control(this, x, 28, width() - 16 - x, 20); + tabBar = new Control(this, x, 28, getWidth() - 16 - x, 20); analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) { @Override @SideOnly(Side.CLIENT) @@ -209,8 +209,8 @@ public class WindowAnalyst extends Window { @Override public void initialise() { setColor(4473924); - int sectionWidth = (width() - 8 - 4) / 2; - leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, height() - 8 + 2, 0) { + int sectionWidth = (getWidth() - 8 - 4) / 2; + leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -221,7 +221,7 @@ public class WindowAnalyst extends Window { CraftGUI.RENDER.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, height() - 8 + 2 - 6, leftPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, getHeight() - 8 + 2 - 6, leftPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -235,7 +235,7 @@ public class WindowAnalyst extends Window { RenderUtil.drawSolidRect(getRenderArea(), leftPage.getContent().getColor()); } }; - rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, height() - 8 + 2, 0) { + rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, getHeight() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -246,7 +246,7 @@ public class WindowAnalyst extends Window { CraftGUI.RENDER.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, height() - 8 + 2 - 6, rightPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, getHeight() - 8 + 2 - 6, rightPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -260,7 +260,7 @@ public class WindowAnalyst extends Window { RenderUtil.drawSolidRect(getRenderArea(), rightPage.getContent().getColor()); } }; - analystPageSize = new Area(1, 1, sectionWidth, height() - 8); + analystPageSize = new Area(1, 1, sectionWidth, getHeight() - 8); } }; if (!isDatabase) { @@ -280,7 +280,7 @@ public class WindowAnalyst extends Window { } }); if (!isDatabase) { - analystNone = new Control(analystPanel, 0, 0, analystPanel.width(), analystPanel.height()) { + analystNone = new Control(analystPanel, 0, 0, analystPanel.getWidth(), analystPanel.getHeight()) { @Override public void initialise() { new ControlTextCentered(this, 20, I18N.localise("genetics.gui.analyst.desc")).setColor(4473924); @@ -342,10 +342,10 @@ public class WindowAnalyst extends Window { } tabBar.deleteAllChildren(); if (analystPages.size() > 0) { - int width = tabBar.width() / analystPages.size(); + int width = tabBar.getWidth() / analystPages.size(); int x = 0; for (ControlAnalystPage page : analystPages) { - new ControlTooltip(tabBar, x, 0, width, tabBar.height()) { + new ControlTooltip(tabBar, x, 0, width, tabBar.getHeight()) { ControlAnalystPage value; @Override diff --git a/src/main/java/binnie/genetics/gui/analyst/bee/AnalystPageProducts.java b/src/main/java/binnie/genetics/gui/analyst/bee/AnalystPageProducts.java index ff107461..5492bbda 100644 --- a/src/main/java/binnie/genetics/gui/analyst/bee/AnalystPageProducts.java +++ b/src/main/java/binnie/genetics/gui/analyst/bee/AnalystPageProducts.java @@ -117,8 +117,8 @@ public class AnalystPageProducts extends AnalystPageProduce { } } - int maxBiomePerLine = (int) ((width() + 2.0f - 16.0f) / 18.0f); - int biomeListX = (width() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (int) ((getWidth() + 2.0f - 16.0f) / 18.0f); + int biomeListX = (getWidth() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; for (ItemStack soilStack : refinedProducts) { @@ -149,7 +149,7 @@ public class AnalystPageProducts extends AnalystPageProduce { } dx += 18; } - setSize(new Point(width(), y + dy + 18 + 8)); + setSize(new Point(getWidth(), y + dy + 18 + 8)); } @Nullable diff --git a/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java b/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java index a68ea9a2..985da52c 100644 --- a/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java +++ b/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java @@ -19,8 +19,8 @@ public class AnalystPageSpecimen extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - int w = Math.round((width() - 16) * ind.getSize()); - new ControlIndividualDisplay(this, (width() - w) / 2, y + (width() - w) / 2, w, ind); + int w = Math.round((getWidth() - 16) * ind.getSize()); + new ControlIndividualDisplay(this, (getWidth() - w) / 2, y + (getWidth() - w) / 2, w, ind); } @Override diff --git a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java index 20e134f7..333469b9 100644 --- a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java +++ b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java @@ -32,17 +32,17 @@ public class AnalystPageAppearance extends ControlAnalystPage { IAlleleSpecies species = genome.getPrimary(); new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - ControlColorDisplay a = new ControlColorDisplay(this, width() / 2 - 28, y, genome.getPrimaryColor()); + ControlColorDisplay a = new ControlColorDisplay(this, getWidth() / 2 - 28, y, genome.getPrimaryColor()); a.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".primary")); - ControlColorDisplay b = new ControlColorDisplay(this, width() / 2 - 8, y, genome.getSecondaryColor()); + ControlColorDisplay b = new ControlColorDisplay(this, getWidth() / 2 - 8, y, genome.getSecondaryColor()); b.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".secondary")); - ControlColorDisplay c = new ControlColorDisplay(this, width() / 2 + 12, y, genome.getStemColor()); + ControlColorDisplay c = new ControlColorDisplay(this, getWidth() / 2 + 12, y, genome.getStemColor()); c.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".stem")); y += 26; IFlowerType type = genome.getType(); int sections = type.getSections(); int width = (sections > 1) ? 50 : 100; - new ControlIconDisplay(this, (width() - width) / 2, y - ((sections == 1) ? 0 : 0)) { + new ControlIconDisplay(this, (getWidth() - width) / 2, y - ((sections == 1) ? 0 : 0)) { @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { diff --git a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java index f81cd31a..ae30a2fb 100644 --- a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java @@ -37,15 +37,15 @@ public class AnalystPageSoil extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - createMoisture(this, (width() - 100) / 2, y, 100, 10, moisture, moistureTol); + createMoisture(this, (getWidth() - 100) / 2, y, 100, 10, moisture, moistureTol); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - createAcidity(this, (width() - 100) / 2, y, 100, 10, pH, pHTol); + createAcidity(this, (getWidth() - 100) / 2, y, 100, 10, pH, pHTol); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); @@ -84,11 +84,11 @@ public class AnalystPageSoil extends ControlAnalystPage { } } ItemStack stack = new ItemStack(Botany.gardening().soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); - ControlItemDisplay recomSoil = new ControlItemDisplay(this, (width() - 24) / 2, y, 24); + ControlItemDisplay recomSoil = new ControlItemDisplay(this, (getWidth() - 24) / 2, y, 24); recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; List stacks = new ArrayList<>(); for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { @@ -99,7 +99,7 @@ public class AnalystPageSoil extends ControlAnalystPage { } } int soilListWidth = 17 * stacks.size() - 1; - int soilListX = (width() - soilListWidth) / 2; + int soilListX = (getWidth() - soilListWidth) / 2; int t = 0; for (ItemStack soilStack : stacks) { ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y); diff --git a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageClimate.java b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageClimate.java index dcadc6e4..e283e762 100644 --- a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageClimate.java +++ b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageClimate.java @@ -55,17 +55,17 @@ public class AnalystPageClimate extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".temp"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".temp"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - createTemperatureBar(this, (width() - 100) / 2, y, 100, 10, temp, tempTol); + createTemperatureBar(this, (getWidth() - 100) / 2, y, 100, 10, temp, tempTol); y += 16; if (!(ind instanceof IFlower)) { - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".hum"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".hum"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - createHumidity(this, (width() - 100) / 2, y, 100, 10, humid, humidTol); + createHumidity(this, (getWidth() - 100) / 2, y, 100, 10, humid, humidTol); y += 16; } - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; List biomes = new ArrayList<>(); for (Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check @@ -84,8 +84,8 @@ public class AnalystPageClimate extends ControlAnalystPage { } } } - int maxBiomePerLine = (width() + 2 - 16) / 18; - int biomeListX = (width() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (getWidth() + 2 - 16) / 18; + int biomeListX = (getWidth() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; for (Biome biome2 : biomes) { @@ -96,7 +96,7 @@ public class AnalystPageClimate extends ControlAnalystPage { dy += 18; } } - setSize(new Point(width(), y + dy + 18 + 8)); + setSize(new Point(getWidth(), y + dy + 18 + 8)); } protected void createTemperatureBar(IWidget parent, int x, int y, int w, int h, EnumTemperature value, EnumTolerance tol) { diff --git a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageFruit.java b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageFruit.java index 55092e08..088abdd0 100644 --- a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageFruit.java +++ b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageFruit.java @@ -61,7 +61,7 @@ public class AnalystPageFruit extends AnalystPageProduce { int w = products.size() * 18 - 2; int i = 0; for (ItemStack stack : products) { - ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); + ControlItemDisplay d = new ControlItemDisplay(this, (getWidth() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } @@ -73,7 +73,7 @@ public class AnalystPageFruit extends AnalystPageProduce { int w = products.size() * 18 - 2; int i = 0; for (ItemStack stack : specialties) { - ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); + ControlItemDisplay d = new ControlItemDisplay(this, (getWidth() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } @@ -121,7 +121,7 @@ public class AnalystPageFruit extends AnalystPageProduce { y = getRefined(TextFormatting.ITALIC + fam.getName(), y, stacks); y += 2; } - setSize(new Point(width(), y + 8)); + setSize(new Point(getWidth(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageWood.java b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageWood.java index 098ee697..fa3f45fb 100644 --- a/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageWood.java +++ b/src/main/java/binnie/genetics/gui/analyst/tree/AnalystPageWood.java @@ -36,9 +36,9 @@ public class AnalystPageWood extends AnalystPageProduce { new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) { - new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".fireproof")); + new ControlIconDisplay(this, (getWidth() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".fireproof")); } else { - new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".flammable")); + new ControlIconDisplay(this, (getWidth() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".flammable")); } y += 30; Collection products = new UniqueItemStackSet(); @@ -56,7 +56,7 @@ public class AnalystPageWood extends AnalystPageProduce { int w = products.size() * 18 - 2; int i = 0; for (ItemStack stack : products) { - ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); + ControlItemDisplay d = new ControlItemDisplay(this, (getWidth() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); i++; @@ -75,7 +75,7 @@ public class AnalystPageWood extends AnalystPageProduce { new ControlTextCentered(this, y, I18N.localise(AnalystConstants.WOOD_KEY + ".noFruits")).setColor(getColor()); y += 28; } - setSize(new Point(width(), y + 8)); + setSize(new Point(getWidth(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java index 07eadb7e..b248a073 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java @@ -63,7 +63,7 @@ public class WindowSequencer extends WindowMachine { final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5); x = 34; y = 92; - this.slotText = new ControlText(this, new Area(0, y, this.width(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER); + this.slotText = new ControlText(this, new Area(0, y, this.getWidth(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER); y += 20; final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0); x += 20; diff --git a/src/main/java/binnie/genetics/machine/splicer/ControlSplicerProgress.java b/src/main/java/binnie/genetics/machine/splicer/ControlSplicerProgress.java index d2ef5b7c..77227cd5 100644 --- a/src/main/java/binnie/genetics/machine/splicer/ControlSplicerProgress.java +++ b/src/main/java/binnie/genetics/machine/splicer/ControlSplicerProgress.java @@ -23,7 +23,7 @@ public class ControlSplicerProgress extends ControlProgressBase { final float progress = this.getProcess().getCurrentProgress() / 100.0f; final float n = this.getProcess().getProcessTime() / 12.0f; final int spacing = 10; - final float range = this.width(); + final float range = this.getWidth(); final int h = 8; final float ooy = -((n - 1.0f) * spacing) - range / 2.0f; final float ddy = (n - 1.0f) * spacing + range; @@ -38,17 +38,17 @@ public class ControlSplicerProgress extends ControlProgressBase { final int y = oy + i * spacing; if (y > -range / 2.0f && y < range / 2.0f) { final float percentView = (float) Math.sqrt(1.0f - Math.abs(2.0f * y / range)); - final float offMovement = (this.height() - 2.0f * h) / 2.0f; + final float offMovement = (this.getHeight() - 2.0f * h) / 2.0f; final int alpha = 16777216 * (int) (255.0f * percentView); c1 += alpha; c2 += alpha; c3 += alpha; c4 += alpha; int viewAmount = Math.round(offMovement * percentView); - RenderUtil.drawSolidRectWithAlpha(new Area(this.width() / 2 + y, viewAmount, 4, h / 2), c1); - RenderUtil.drawSolidRectWithAlpha(new Area(this.width() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3); - RenderUtil.drawSolidRectWithAlpha(new Area(this.width() / 2 + y, this.height() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2); - RenderUtil.drawSolidRectWithAlpha(new Area(this.width() / 2 + y, this.height() - viewAmount - 4, 4, h / 2), c4); + RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, viewAmount, 4, h / 2), c1); + RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3); + RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, this.getHeight() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2); + RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, this.getHeight() - viewAmount - 4, 4, h / 2), c4); } } } diff --git a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java index 122fa63e..c0428a59 100644 --- a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java @@ -38,7 +38,7 @@ public class WindowSplicer extends WindowMachine { public void initialiseClient() { super.initialiseClient(); int x = 16; - new ControlSplicerProgress(this, 84, 32, this.width() - 172, 102); + new ControlSplicerProgress(this, 84, 32, this.getWidth() - 172, 102); CraftGUIUtil.horizontalGrid(x, 62, new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), @@ -49,7 +49,7 @@ public class WindowSplicer extends WindowMachine { new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT); new ControlErrorState(this, 218, 86); x += 142; - CraftGUIUtil.verticalGrid((this.width() - 72) / 2, 32, TextJustification.MIDDLE_CENTER, 4, + CraftGUIUtil.verticalGrid((this.getWidth() - 72) / 2, 32, TextJustification.MIDDLE_CENTER, 4, new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_DOWN.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(9),