use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiRemoteStorage method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
for (int i = 0; i < 4; i++) {
global[i] = new ImageChoiceLabel(mc, this);
final int finalI = i;
global[i].addChoiceEvent((parent, newChoice) -> changeGlobal(finalI));
global[i].addChoice("off" + i, "Cross-dimension access disabled", guiElements, 0, 32);
global[i].addChoice("on" + i, "Cross-dimension access enabled", guiElements, 16, 32);
global[i].setLayoutHint(new PositionalLayout.PositionalHint(i < 2 ? (43 - 18) : (120 - 18), (i % 2) == 0 ? 9 : 36, 16, 16));
global[i].setCurrentChoice(tileEntity.isGlobal(i) ? 1 : 0);
toplevel.addChild(global[i]);
}
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiBuilder method setupPositionPanel.
private Panel setupPositionPanel() {
rotateButton = new ChoiceLabel(mc, this).addChoices(ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270).setLayoutHint(new PositionalLayout.PositionalHint(4, 4, 36, 14)).setTooltips("Set the horizontal rotation angle").addChoiceEvent((parent, newChoice) -> updateRotate());
switch(tileEntity.getRotate()) {
case 0:
rotateButton.setChoice(ROTATE_0);
break;
case 1:
rotateButton.setChoice(ROTATE_90);
break;
case 2:
rotateButton.setChoice(ROTATE_180);
break;
case 3:
rotateButton.setChoice(ROTATE_270);
break;
}
Panel positionPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(128, 6, 44, 59)).addChild(rotateButton).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
String[] choiceDescriptions = { "Builder at south west corner", "Builder at south east corner", "Builder at north west corner", "Builder at north east corner" };
for (int y = 0; y <= 1; y++) {
for (int x = 0; x <= 1; x++) {
final int index = x + y * 2;
anchor[index] = new ImageChoiceLabel(mc, this).setWithBorder(true).setHighlightedChoice(1).setLayoutHint(new PositionalLayout.PositionalHint(4 + x * 19, 18 + (1 - y) * 19, 17, 17)).setTooltips("Set the anchor where you want to", "place the blocks in front of the", "builder");
anchor[index].addChoice("off", choiceDescriptions[index], guiElements, (7 + index * 2) * 16, 4 * 16);
anchor[index].addChoice("on", choiceDescriptions[index], guiElements, (6 + index * 2) * 16, 4 * 16);
anchor[index].addChoiceEvent((widget, s) -> selectAnchor(index));
positionPanel.addChild(anchor[index]);
}
}
if (!isShapeCard()) {
anchor[tileEntity.getAnchor()].setCurrentChoice(1);
}
return positionPanel;
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiBlockProtector method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
initRedstoneMode();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(redstoneMode);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
tileEntity.requestRfFromServer(RFTools.MODID);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiShapeCard method initGui.
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
ItemStack heldItem = getStackToEdit();
if (heldItem.isEmpty()) {
// Cannot happen!
return;
}
isQuarryCard = ShapeCardType.fromDamage(heldItem.getItemDamage()).isQuarry();
if (isQuarryCard) {
ySize = 160 + 28;
}
getShapeRenderer().initView(getPreviewLeft(), guiTop);
shapeLabel = new ChoiceLabel(mc, this).setDesiredWidth(100).setDesiredHeight(16).addChoices(mcjty.rftools.shapes.Shape.SHAPE_BOX.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_TOPDOME.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_BOTTOMDOME.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_SPHERE.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_CYLINDER.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_CAPPEDCYLINDER.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_PRISM.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_TORUS.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_CONE.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_HEART.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_COMPOSITION.getDescription(), mcjty.rftools.shapes.Shape.SHAPE_SCAN.getDescription()).addChoiceEvent((parent, newChoice) -> updateSettings());
solidLabel = new ChoiceLabel(mc, this).setDesiredWidth(50).setDesiredHeight(16).addChoices("Hollow", "Solid").addChoiceEvent((parent, newChoice) -> updateSettings());
Panel shapePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(shapeLabel).addChild(solidLabel);
mcjty.rftools.shapes.Shape shape = ShapeCardItem.getShape(heldItem);
shapeLabel.setChoice(shape.getDescription());
boolean solid = ShapeCardItem.isSolid(heldItem);
solidLabel.setChoice(solid ? "Solid" : "Hollow");
blocksLabel = new Label(mc, this).setText("# ").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
blocksLabel.setDesiredWidth(100).setDesiredHeight(16);
Panel modePanel = new Panel(mc, this).setLayout(new VerticalLayout()).setDesiredWidth(170).addChild(shapePanel).addChild(blocksLabel);
BlockPos dim = ShapeCardItem.getDimension(heldItem);
BlockPos offset = ShapeCardItem.getOffset(heldItem);
dimX = new TextField(mc, this).addTextEvent((parent, newText) -> {
if (isTorus()) {
dimZ.setText(newText);
}
updateSettings();
}).setText(String.valueOf(dim.getX()));
dimY = new TextField(mc, this).addTextEvent((parent, newText) -> updateSettings()).setText(String.valueOf(dim.getY()));
dimZ = new TextField(mc, this).addTextEvent((parent, newText) -> updateSettings()).setText(String.valueOf(dim.getZ()));
Panel dimPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(0)).addChild(new Label(mc, this).setText("Dim:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setDesiredWidth(40)).setDesiredHeight(18).addChild(dimX).addChild(dimY).addChild(dimZ);
offsetX = new TextField(mc, this).addTextEvent((parent, newText) -> updateSettings()).setText(String.valueOf(offset.getX()));
offsetY = new TextField(mc, this).addTextEvent((parent, newText) -> updateSettings()).setText(String.valueOf(offset.getY()));
offsetZ = new TextField(mc, this).addTextEvent((parent, newText) -> updateSettings()).setText(String.valueOf(offset.getZ()));
Panel offsetPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(0)).addChild(new Label(mc, this).setText("Offset:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setDesiredWidth(40)).setDesiredHeight(18).addChild(offsetX).addChild(offsetY).addChild(offsetZ);
Panel settingsPanel = new Panel(mc, this).setLayout(new VerticalLayout().setSpacing(1).setVerticalMargin(1).setHorizontalMargin(0)).addChild(dimPanel).addChild(offsetPanel);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
Panel modeSettingsPanel = new Panel(mc, this).setLayout(new VerticalLayout().setHorizontalMargin(0)).addChild(modePanel).addChild(settingsPanel);
modeSettingsPanel.setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 180, 160));
Panel toplevel;
if (isQuarryCard) {
setupVoidPanel(heldItem);
toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setFilledRectThickness(2).addChild(modeSettingsPanel).addChild(voidPanel);
} else {
toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setFilledRectThickness(2).addChild(modeSettingsPanel);
}
toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiModifier method refreshList.
private void refreshList() {
list.removeChildren();
List<ModifierEntry> modifiers = getModifiers();
for (ModifierEntry modifier : modifiers) {
ItemStack stackIn = modifier.getIn();
ItemStack stackOut = modifier.getOut();
ModifierFilterType type = modifier.getType();
ModifierFilterOperation op = modifier.getOp();
Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setDesiredHeight(18).setDesiredWidth(150);
panel.addChild(new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(1, 0, 18, 18)).setRenderItem(stackIn));
panel.addChild(new Label<>(mc, this).setText(type.getCode() + " -> " + op.getCode()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(22, 0, 100, 18)));
panel.addChild(new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(130, 0, 18, 18)).setRenderItem(stackOut));
list.addChild(panel);
}
}
Aggregations