Search in sources :

Example 31 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiShapeCard method setupVoidPanel.

private void setupVoidPanel(ItemStack heldItem) {
    voidPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(26).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    voidPanel.setLayoutHint(new PositionalLayout.PositionalHint(5, 155, 350, 26));
    Label label = new Label(mc, this).setText("Void:");
    stone = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void stone").addButtonEvent(widget -> updateVoidSettings());
    cobble = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void cobble").addButtonEvent(widget -> updateVoidSettings());
    dirt = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void dirt").addButtonEvent(widget -> updateVoidSettings());
    gravel = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void gravel").addButtonEvent(widget -> updateVoidSettings());
    sand = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void sand").addButtonEvent(widget -> updateVoidSettings());
    netherrack = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void netherrack").addButtonEvent(widget -> updateVoidSettings());
    endstone = new ToggleButton(mc, this).setDesiredWidth(20).setDesiredHeight(20).setTooltips("Void end stone").addButtonEvent(widget -> updateVoidSettings());
    oredict = new ToggleButton(mc, this).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Enable ore dictionary matching").setText("Oredict").setCheckMarker(true).addButtonEvent(widget -> updateVoidSettings());
    stone.setPressed(ShapeCardItem.isVoiding(heldItem, "stone"));
    cobble.setPressed(ShapeCardItem.isVoiding(heldItem, "cobble"));
    dirt.setPressed(ShapeCardItem.isVoiding(heldItem, "dirt"));
    gravel.setPressed(ShapeCardItem.isVoiding(heldItem, "gravel"));
    sand.setPressed(ShapeCardItem.isVoiding(heldItem, "sand"));
    netherrack.setPressed(ShapeCardItem.isVoiding(heldItem, "netherrack"));
    endstone.setPressed(ShapeCardItem.isVoiding(heldItem, "endstone"));
    oredict.setPressed(ShapeCardItem.isOreDictionary(heldItem));
    voidPanel.addChild(label).addChild(stone).addChild(cobble).addChild(dirt).addChild(gravel).addChild(sand).addChild(netherrack).addChild(endstone).addChild(oredict);
}
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) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 32 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiDevelopersDelight method createNbtDataPage.

private Panel createNbtDataPage() {
    nbtDataList = new WidgetList(mc, this);
    Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(nbtDataList);
    return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(nbtDataList).addChild(listSlider);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 33 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiDevelopersDelight method initGui.

@Override
public void initGui() {
    super.initGui();
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    tabbedPanel = new TabbedPanel(mc, this);
    Panel tab1 = createBlockClassesPage();
    Panel tab2 = createTeClassesPage();
    Panel tab3 = createNbtDataPage();
    tabbedPanel.addPage("Block", tab1).addPage("TE", tab2).addPage("NBT", tab3);
    ToggleButton tab1Button = createToggleButton("Block");
    ToggleButton tab2Button = createToggleButton("TE");
    ToggleButton tab3Button = createToggleButton("NBT");
    clientServerMode = new ChoiceLabel(mc, this).setDesiredWidth(60).addChoices("Server", "Client").setChoice("Server").addChoiceEvent((parent, newChoice) -> requestNewLists()).setDesiredHeight(16).setTooltips("Switch between client", "and server information");
    metaData = new TextField(mc, this).setDesiredHeight(14).setTooltips("Metadata for this block");
    Panel buttonPanel = new Panel(mc, this).setLayout(new VerticalLayout()).setDesiredWidth(62).addChild(tab1Button).addChild(tab2Button).addChild(tab3Button).addChild(new Label(mc, this).setDynamic(true)).addChild(clientServerMode).addChild(metaData).addChild(new Label(mc, this).setDynamic(true));
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new HorizontalLayout()).addChild(buttonPanel).addChild(tabbedPanel);
    toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
    window = new Window(this, toplevel);
    requestNewLists();
}
Also used : RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) HashMap(java.util.HashMap) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) Mouse(org.lwjgl.input.Mouse) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) java.awt(java.awt) IBlockState(net.minecraft.block.state.IBlockState) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) GuiScreen(net.minecraft.client.gui.GuiScreen) List(java.util.List) Panel(mcjty.lib.gui.widgets.Panel) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) Map(java.util.Map) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 34 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiDevelopersDelight method populateLists.

private void populateLists() {
    if (!listsDirty) {
        return;
    }
    if (teClasses == null || blockClasses == null || nbtData == null) {
        return;
    }
    listsDirty = false;
    blockClassList.removeChildren();
    IBlockState state = Minecraft.getMinecraft().world.getBlockState(selected);
    Block block = state.getBlock();
    blockClassList.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText("Loc Name: " + block.getLocalizedName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
    blockClassList.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText("Unloc Name: " + block.getUnlocalizedName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
    blockClassList.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText("Block Name: " + Block.REGISTRY.getNameForObject(block)).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
    for (String c : blockClasses) {
        blockClassList.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText("Class: " + c).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
    }
    teClassList.removeChildren();
    for (String c : teClasses) {
        teClassList.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(c).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
    }
    nbtDataList.removeChildren();
    for (Map.Entry<String, DelightingInfoHelper.NBTDescription> me : nbtData.entrySet()) {
        Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(me.getKey()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(70));
        DelightingInfoHelper.NBTDescription value = me.getValue();
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(value.getType()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(50));
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(value.getValue()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
        nbtDataList.addChild(panel);
    }
    metaData.setText(String.valueOf(server_metadata));
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) IBlockState(net.minecraft.block.state.IBlockState) Label(mcjty.lib.gui.widgets.Label) Block(net.minecraft.block.Block) HashMap(java.util.HashMap) Map(java.util.Map) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 35 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiTeleportProbe method populateList.

private void populateList() {
    if (serverDestinationList == null) {
        return;
    }
    if (serverDestinationList.equals(destinationList)) {
        return;
    }
    destinationList = new ArrayList<>(serverDestinationList);
    list.removeChildren();
    for (TeleportDestinationClientInfo destination : destinationList) {
        BlockPos coordinate = destination.getCoordinate();
        int dim = destination.getDimension();
        Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(destination.getName()).setDesiredWidth(100));
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(BlockPosTools.toString(coordinate)).setDesiredWidth(75));
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Id " + dim).setDesiredWidth(75));
        list.addChild(panel);
    }
}
Also used : TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) BlockPos(net.minecraft.util.math.BlockPos) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Aggregations

HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)75 Panel (mcjty.lib.gui.widgets.Panel)55 Window (mcjty.lib.gui.Window)38 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)32 TextField (mcjty.lib.gui.widgets.TextField)25 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)24 java.awt (java.awt)21 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)21 List (java.util.List)20 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)20 Button (mcjty.lib.gui.widgets.Button)20 Argument (mcjty.lib.network.Argument)19 RFTools (mcjty.rftools.RFTools)19 BlockPos (net.minecraft.util.math.BlockPos)19 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 StyleConfig (mcjty.lib.base.StyleConfig)16 ResourceLocation (net.minecraft.util.ResourceLocation)15 Minecraft (net.minecraft.client.Minecraft)14 EmptyContainer (mcjty.lib.container.EmptyContainer)13