Finished Layout of GuiObjectManager

This commit is contained in:
CrushedPixel
2015-07-08 16:54:14 +02:00
parent 80a47a61c8
commit 2d19b17626
7 changed files with 375 additions and 23 deletions

View File

@@ -1,14 +1,27 @@
package eu.crushedpixel.replaymod.gui.elements;
import lombok.Getter;
import net.minecraft.client.Minecraft;
public class ComposedElement implements GuiElement {
private final GuiElement[] parts;
@Getter
private GuiElement[] parts;
public ComposedElement(GuiElement...parts) {
this.parts = parts;
}
public void addPart(GuiElement part) {
GuiElement[] newParts = new GuiElement[parts.length+1];
int i = 0;
for(GuiElement e : parts) {
newParts[i] = e;
i++;
}
newParts[i] = part;
this.parts = newParts;
}
@Override
public void draw(Minecraft mc, int mouseX, int mouseY) {
for (GuiElement part : parts) {

View File

@@ -26,10 +26,16 @@ public class GuiNumberInput extends GuiAdvancedTextField {
}
public void setValue(double value) {
if(acceptFloats) {
setText("" + value);
if(minimum != null && value < minimum) {
setText(acceptFloats ? minimum.toString() : Integer.toString((int) Math.round(minimum)));
} else if(maximum != null && value > maximum) {
setText(acceptFloats ? maximum.toString() : Integer.toString((int) Math.round(maximum)));
} else {
setText("" + (int)Math.round(value));
if(acceptFloats) {
setText("" + value);
} else {
setText("" + (int) Math.round(value));
}
}
setCursorPositionZero();
}