use of mcjty.lib.gui.Window 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.Window in project RFTools by McJty.
the class GuiRFToolsManual method initGui.
@Override
public void initGui() {
super.initGui();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
textPage = new TextPage(RFTools.instance, mc, this).setText(manualText).setArrowImage(iconGuiElements, 144, 0).setCraftingGridImage(iconGuiElements, 0, 192);
prevButton = new Button(mc, this).setText("<").addButtonEvent(parent -> {
// System.out.println("GuiRFToolsManual.buttonClicked: <");
textPage.prevPage();
window.setTextFocus(textPage);
});
pageLabel = new Label(mc, this).setText("0 / 0");
nextButton = new Button(mc, this).setText(">").addButtonEvent(parent -> {
// System.out.println("GuiRFToolsManual.buttonClicked: >");
textPage.nextPage();
window.setTextFocus(textPage);
});
Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16).addChild(prevButton).addChild(pageLabel).addChild(nextButton);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(textPage).addChild(buttonPanel);
toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
window = new Window(this, toplevel);
window.setTextFocus(textPage);
if (locatePage != null) {
textPage.gotoNode(locatePage);
locatePage = null;
}
}
use of mcjty.lib.gui.Window in project RFTools by McJty.
the class GuiStorageFilter method initGui.
@Override
public void initGui() {
super.initGui();
blacklistMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(130, 9, 16, 16)).setTooltips("Black or whitelist mode").addChoiceEvent((parent, newChoice) -> updateSettings());
blacklistMode.addChoice("Black", "Blacklist items", guiElements, 14 * 16, 32);
blacklistMode.addChoice("White", "Whitelist items", guiElements, 15 * 16, 32);
oredictMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(148, 9, 16, 16)).setTooltips("Filter based on ore dictionary").addChoiceEvent((parent, newChoice) -> updateSettings());
oredictMode.addChoice("Off", "Oredict matching off", guiElements, 10 * 16, 32);
oredictMode.addChoice("On", "Oredict matching on", guiElements, 11 * 16, 32);
damageMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(130, 27, 16, 16)).setTooltips("Filter ignoring damage").addChoiceEvent((parent, newChoice) -> updateSettings());
damageMode.addChoice("Off", "Ignore damage", guiElements, 6 * 16, 32);
damageMode.addChoice("On", "Damage must match", guiElements, 7 * 16, 32);
nbtMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(148, 27, 16, 16)).setTooltips("Filter ignoring NBT").addChoiceEvent((parent, newChoice) -> updateSettings());
nbtMode.addChoice("Off", "Ignore NBT", guiElements, 8 * 16, 32);
nbtMode.addChoice("On", "NBT must match", guiElements, 9 * 16, 32);
modMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(130, 45, 16, 16)).setTooltips("Filter ignoring mod").addChoiceEvent((parent, newChoice) -> updateSettings());
modMode.addChoice("Off", "Don't match on mod", guiElements, 12 * 16, 32);
modMode.addChoice("On", "Only mod must match", guiElements, 13 * 16, 32);
NBTTagCompound tagCompound = Minecraft.getMinecraft().player.getHeldItem(EnumHand.MAIN_HAND).getTagCompound();
if (tagCompound != null) {
setBlacklistMode(tagCompound.getString("blacklistMode"));
oredictMode.setCurrentChoice(tagCompound.getBoolean("oredictMode") ? 1 : 0);
damageMode.setCurrentChoice(tagCompound.getBoolean("damageMode") ? 1 : 0);
nbtMode.setCurrentChoice(tagCompound.getBoolean("nbtMode") ? 1 : 0);
modMode.setCurrentChoice(tagCompound.getBoolean("modMode") ? 1 : 0);
}
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation).addChild(blacklistMode).addChild(oredictMode).addChild(damageMode).addChild(nbtMode).addChild(modMode);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.Window in project RFTools by McJty.
the class GuiTeleportProbe method initGui.
@Override
public void initGui() {
super.initGui();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void doubleClick(Widget parent, int index) {
teleport(index);
}
});
Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(list);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(list).addChild(listSlider);
toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
window = new Window(this, toplevel);
serverDestinationList = null;
destinationList = null;
requestReceiversFromServer();
}
use of mcjty.lib.gui.Window in project RFTools by McJty.
the class GuiNetworkMonitor method initGui.
@Override
public void initGui() {
super.initGui();
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void doubleClick(Widget parent, int index) {
hilightBlock(index);
}
});
listDirty = 0;
Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(list);
Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(list).addChild(listSlider);
showRfPerTick = new ToggleButton(mc, this).setCheckMarker(true).setText("RF/tick").setDesiredWidth(80).addButtonEvent(parent -> previousRfMillis = 0).setDesiredHeight(14);
filterTextField = new TextField(mc, this).setDesiredHeight(14).addTextEvent((parent, newText) -> {
filter = filterTextField.getText();
if (filter.trim().isEmpty()) {
filter = null;
}
connectedBlocks = null;
});
Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(showRfPerTick).addChild(new Label(mc, this).setText("Filter:")).addChild(filterTextField).setDesiredHeight(17);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setVerticalMargin(3)).addChild(listPanel).addChild(buttonPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
serverConnectedBlocks = null;
}
Aggregations