use of com.simibubi.create.foundation.gui.widget.Label in project Create by Creators-of-Create.
the class SchematicEditScreen method init.
@Override
protected void init() {
setWindowSize(background.width, background.height);
setWindowOffset(-6, 0);
super.init();
int x = guiLeft;
int y = guiTop;
xInput = new EditBox(font, x + 50, y + 26, 34, 10, TextComponent.EMPTY);
yInput = new EditBox(font, x + 90, y + 26, 34, 10, TextComponent.EMPTY);
zInput = new EditBox(font, x + 130, y + 26, 34, 10, TextComponent.EMPTY);
BlockPos anchor = handler.getTransformation().getAnchor();
if (handler.isDeployed()) {
xInput.setValue("" + anchor.getX());
yInput.setValue("" + anchor.getY());
zInput.setValue("" + anchor.getZ());
} else {
BlockPos alt = minecraft.player.blockPosition();
xInput.setValue("" + alt.getX());
yInput.setValue("" + alt.getY());
zInput.setValue("" + alt.getZ());
}
for (EditBox widget : new EditBox[] { xInput, yInput, zInput }) {
widget.setMaxLength(6);
widget.setBordered(false);
widget.setTextColor(0xFFFFFF);
widget.changeFocus(false);
widget.mouseClicked(0, 0, 0);
widget.setFilter(s -> {
if (s.isEmpty() || s.equals("-"))
return true;
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
});
}
StructurePlaceSettings settings = handler.getTransformation().toSettings();
Label labelR = new Label(x + 50, y + 48, TextComponent.EMPTY).withShadow();
rotationArea = new SelectionScrollInput(x + 45, y + 43, 118, 18).forOptions(rotationOptions).titled(rotationLabel.plainCopy()).setState(settings.getRotation().ordinal()).writingTo(labelR);
Label labelM = new Label(x + 50, y + 70, TextComponent.EMPTY).withShadow();
mirrorArea = new SelectionScrollInput(x + 45, y + 65, 118, 18).forOptions(mirrorOptions).titled(mirrorLabel.plainCopy()).setState(settings.getMirror().ordinal()).writingTo(labelM);
addRenderableWidgets(xInput, yInput, zInput);
addRenderableWidgets(labelR, labelM, rotationArea, mirrorArea);
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
onClose();
});
addRenderableWidget(confirmButton);
}
Aggregations