Search in sources :

Example 46 with Window

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);
}
Also used : RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) Blocks(net.minecraft.init.Blocks) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumHand(net.minecraft.util.EnumHand) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Block(net.minecraft.block.Block) PacketUpdateNBTShapeCard(mcjty.rftools.shapes.PacketUpdateNBTShapeCard) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ShapeRenderer(mcjty.rftools.shapes.ShapeRenderer) GL11(org.lwjgl.opengl.GL11) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ScannerConfiguration(mcjty.rftools.blocks.shaper.ScannerConfiguration) GlStateManager(net.minecraft.client.renderer.GlStateManager) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Mouse(org.lwjgl.input.Mouse) Argument(mcjty.lib.network.Argument) GuiScreen(net.minecraft.client.gui.GuiScreen) List(java.util.List) Tessellator(net.minecraft.client.renderer.Tessellator) IInventory(net.minecraft.inventory.IInventory) IShapeParentGui(mcjty.rftools.shapes.IShapeParentGui) RenderHelper(mcjty.lib.gui.RenderHelper) TileEntity(net.minecraft.tileentity.TileEntity) ShapeID(mcjty.rftools.shapes.ShapeID) BuilderConfiguration(mcjty.rftools.blocks.builder.BuilderConfiguration) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Example 47 with Window

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;
    }
}
Also used : mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) IOException(java.io.IOException) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) Mouse(org.lwjgl.input.Mouse) Window(mcjty.lib.gui.Window) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) GuiScreen(net.minecraft.client.gui.GuiScreen) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 48 with Window

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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EnumHand(net.minecraft.util.EnumHand) Window(mcjty.lib.gui.Window) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) GenericTileEntity(mcjty.lib.entity.GenericTileEntity) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

Example 49 with Window

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();
}
Also used : Window(mcjty.lib.gui.Window) Rectangle(java.awt.Rectangle) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 50 with Window

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;
}
Also used : RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) GuiItemScreen(mcjty.lib.gui.GuiItemScreen) BlockInfo(mcjty.rftools.BlockInfo) BlockPos(net.minecraft.util.math.BlockPos) HashMap(java.util.HashMap) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) BlockPosTools(mcjty.lib.varia.BlockPosTools) IBlockState(net.minecraft.block.state.IBlockState) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Minecraft(net.minecraft.client.Minecraft) Logging(mcjty.lib.varia.Logging) Map(java.util.Map) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Rectangle(java.awt.Rectangle) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Aggregations

Window (mcjty.lib.gui.Window)74 Panel (mcjty.lib.gui.widgets.Panel)57 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)48 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)29 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)28 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)24 Argument (mcjty.lib.network.Argument)24 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)23 java.awt (java.awt)22 Button (mcjty.lib.gui.widgets.Button)22 RFTools (mcjty.rftools.RFTools)22 TextField (mcjty.lib.gui.widgets.TextField)21 Rectangle (java.awt.Rectangle)20 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)20 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 ResourceLocation (net.minecraft.util.ResourceLocation)17 StyleConfig (mcjty.lib.base.StyleConfig)15 List (java.util.List)12 EmptyContainer (mcjty.lib.container.EmptyContainer)11