use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiProcessor method openValueEditor.
private void openValueEditor(int varIdx) {
if (fromServer_vars == null || varIdx > fromServer_vars.size()) {
return;
}
if (fromServer_vars.get(varIdx) == null) {
GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
return;
}
Parameter parameter = fromServer_vars.get(varIdx);
if (parameter == null) {
GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
return;
}
ParameterType type = parameter.getParameterType();
ParameterEditor editor = ParameterEditors.getEditor(type);
Panel editPanel;
if (editor != null) {
editPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setFilledRectThickness(1);
editor.build(mc, this, editPanel, o -> {
NBTTagCompound tag = new NBTTagCompound();
ParameterTypeTools.writeToNBT(tag, type, o);
RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketVariableToServer(tileEntity.getPos(), varIdx, tag));
});
editor.writeValue(parameter.getParameterValue());
editor.constantOnly();
} else {
return;
}
Panel panel = new Panel(mc, this).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
panel.setBounds(new Rectangle(50, 50, 200, 60 + editor.getHeight()));
Window modalWindow = getWindowManager().createModalWindow(panel);
panel.addChild(new Label(mc, this).setText("Var " + varIdx + ":"));
panel.addChild(editPanel);
panel.addChild(new Button(mc, this).addButtonEvent(w -> {
getWindowManager().closeWindow(modalWindow);
}).setText("Close"));
}
use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiCraftingCard method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
toplevel.addChild(new Label(mc, this).setText("Regular 3x3 crafting recipe").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 4, 160, 14)));
toplevel.addChild(new Label(mc, this).setText("or more complicated recipes").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 17, 160, 14)));
toplevel.addChild(new Button(mc, this).setText("Update").setTooltips("Update the item in the output", "slot to the recipe in the", "3x3 grid").addButtonEvent(parent -> RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketSendServerCommand(RFToolsControl.MODID, CommandHandler.CMD_TESTRECIPE, Arguments.EMPTY))).setLayoutHint(new PositionalLayout.PositionalHint(110, 57, 60, 14)));
ToggleButton toggle = new ToggleButton(mc, this).setCheckMarker(true).setText("NBT").setTooltips("Enable this if you want", "opcodes like 'get_ingredients'", "to strictly match on NBT").setLayoutHint(new PositionalLayout.PositionalHint(110, 74, 60, 14));
ItemStack heldItem = mc.player.getHeldItem(EnumHand.MAIN_HAND);
if (!heldItem.isEmpty()) {
toggle.setPressed(CraftingCardItem.isStrictNBT(heldItem));
}
toggle.addButtonEvent(parent -> {
RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemCard(new Argument("strictnbt", toggle.isPressed())));
});
toplevel.addChild(toggle);
for (int y = 0; y < GRID_HEIGHT; y++) {
for (int x = 0; x < GRID_WIDTH; x++) {
int idx = y * GRID_WIDTH + x;
createDummySlot(toplevel, idx, new PositionalLayout.PositionalHint(x * 18 + 10, y * 18 + 37, 18, 18), createSelectionEvent(idx));
}
}
createDummySlot(toplevel, INPUT_SLOTS, new PositionalLayout.PositionalHint(10 + 8 * 18, 37, 18, 18), createSelectionEvent(INPUT_SLOTS));
updateSlots();
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiMultiTank method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
for (int i = 0; i < TANKS; i++) {
liquids[i] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(10, 9 + i * 18, 16, 16));
toplevel.addChild(liquids[i]);
labels[i] = new Label(mc, this);
labels[i].setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setVerticalAlignment(VerticalAlignment.ALIGN_CENTER).setLayoutHint(new PositionalLayout.PositionalHint(32, 9 + i * 18, WIDTH - 32 - 6, 16));
toplevel.addChild(labels[i]);
}
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiNode method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
channelField = new TextField(mc, this).setTooltips("Set the name of the network", "channel to connect too").addTextEvent((parent, newText) -> updateNode());
channelField.setText(tileEntity.getChannelName());
nodeNameField = new TextField(mc, this).setTooltips("Set the name of this node").addTextEvent((parent, newText) -> updateNode());
nodeNameField.setText(tileEntity.getNodeName());
Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Channel:")).addChild(channelField).addChild(new Label(mc, this).setText("Node:")).addChild(nodeNameField);
toplevel.addChild(bottomPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiWorkbench method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(mainBackground);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
window = new Window(this, toplevel);
}
Aggregations