Search in sources :

Example 51 with HorizontalLayout

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

the class GuiCrafter method addRecipeLine.

private void addRecipeLine(ItemStack craftingResult) {
    String readableName = BlockTools.getReadableName(craftingResult);
    int color = StyleConfig.colorTextInListNormal;
    if (craftingResult.isEmpty()) {
        readableName = "<no recipe>";
        color = 0xFF505050;
    }
    Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new BlockRender(mc, this).setRenderItem(craftingResult).setTooltips("Double click to edit this recipe")).addChild(new Label(mc, this).setColor(color).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDynamic(true).setText(readableName).setTooltips("Double click to edit this recipe"));
    recipeList.addChild(panel);
}
Also used : HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 52 with HorizontalLayout

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

the class GuiChamberDetails method initGui.

@Override
public void initGui() {
    super.initGui();
    blockList = new WidgetList(mc, this);
    Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(blockList);
    Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(blockList).addChild(listSlider);
    infoLabel = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    infoLabel.setDesiredWidth(380).setDesiredHeight(14);
    info2Label = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    info2Label.setDesiredWidth(380).setDesiredHeight(14);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setSpacing(1).setVerticalMargin(3)).addChild(listPanel).addChild(infoLabel).addChild(info2Label);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Rectangle(java.awt.Rectangle) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 53 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout 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 54 with HorizontalLayout

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

the class GuiDevelopersDelight method createBlockClassesPage.

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

Example 55 with HorizontalLayout

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

the class GuiDevelopersDelight method createTeClassesPage.

private Panel createTeClassesPage() {
    teClassList = new WidgetList(mc, this);
    Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(teClassList);
    return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(teClassList).addChild(listSlider);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) 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