Search in sources :

Example 41 with PositionalLayout

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

the class GuiRemoteStorage method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
    for (int i = 0; i < 4; i++) {
        global[i] = new ImageChoiceLabel(mc, this);
        final int finalI = i;
        global[i].addChoiceEvent((parent, newChoice) -> changeGlobal(finalI));
        global[i].addChoice("off" + i, "Cross-dimension access disabled", guiElements, 0, 32);
        global[i].addChoice("on" + i, "Cross-dimension access enabled", guiElements, 16, 32);
        global[i].setLayoutHint(new PositionalLayout.PositionalHint(i < 2 ? (43 - 18) : (120 - 18), (i % 2) == 0 ? 9 : 36, 16, 16));
        global[i].setCurrentChoice(tileEntity.isGlobal(i) ? 1 : 0);
        toplevel.addChild(global[i]);
    }
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel) EnergyBar(mcjty.lib.gui.widgets.EnergyBar)

Example 42 with PositionalLayout

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

the class GuiBuilder method setupPositionPanel.

private Panel setupPositionPanel() {
    rotateButton = new ChoiceLabel(mc, this).addChoices(ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270).setLayoutHint(new PositionalLayout.PositionalHint(4, 4, 36, 14)).setTooltips("Set the horizontal rotation angle").addChoiceEvent((parent, newChoice) -> updateRotate());
    switch(tileEntity.getRotate()) {
        case 0:
            rotateButton.setChoice(ROTATE_0);
            break;
        case 1:
            rotateButton.setChoice(ROTATE_90);
            break;
        case 2:
            rotateButton.setChoice(ROTATE_180);
            break;
        case 3:
            rotateButton.setChoice(ROTATE_270);
            break;
    }
    Panel positionPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(128, 6, 44, 59)).addChild(rotateButton).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    String[] choiceDescriptions = { "Builder at south west corner", "Builder at south east corner", "Builder at north west corner", "Builder at north east corner" };
    for (int y = 0; y <= 1; y++) {
        for (int x = 0; x <= 1; x++) {
            final int index = x + y * 2;
            anchor[index] = new ImageChoiceLabel(mc, this).setWithBorder(true).setHighlightedChoice(1).setLayoutHint(new PositionalLayout.PositionalHint(4 + x * 19, 18 + (1 - y) * 19, 17, 17)).setTooltips("Set the anchor where you want to", "place the blocks in front of the", "builder");
            anchor[index].addChoice("off", choiceDescriptions[index], guiElements, (7 + index * 2) * 16, 4 * 16);
            anchor[index].addChoice("on", choiceDescriptions[index], guiElements, (6 + index * 2) * 16, 4 * 16);
            anchor[index].addChoiceEvent((widget, s) -> selectAnchor(index));
            positionPanel.addChild(anchor[index]);
        }
    }
    if (!isShapeCard()) {
        anchor[tileEntity.getAnchor()].setCurrentChoice(1);
    }
    return positionPanel;
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) TextFormatting(net.minecraft.util.text.TextFormatting) RedstoneMode(mcjty.lib.varia.RedstoneMode) GuiShapeCard(mcjty.rftools.items.builder.GuiShapeCard) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) java.awt(java.awt) ItemStack(net.minecraft.item.ItemStack) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) BuilderTileEntity(mcjty.rftools.blocks.builder.BuilderTileEntity) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) RFTools(mcjty.rftools.RFTools) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 43 with PositionalLayout

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

the class GuiBlockProtector method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    initRedstoneMode();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(redstoneMode);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) EnergyBar(mcjty.lib.gui.widgets.EnergyBar)

Example 44 with PositionalLayout

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

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

the class GuiModifier method refreshList.

private void refreshList() {
    list.removeChildren();
    List<ModifierEntry> modifiers = getModifiers();
    for (ModifierEntry modifier : modifiers) {
        ItemStack stackIn = modifier.getIn();
        ItemStack stackOut = modifier.getOut();
        ModifierFilterType type = modifier.getType();
        ModifierFilterOperation op = modifier.getOp();
        Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setDesiredHeight(18).setDesiredWidth(150);
        panel.addChild(new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(1, 0, 18, 18)).setRenderItem(stackIn));
        panel.addChild(new Label<>(mc, this).setText(type.getCode() + " -> " + op.getCode()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(22, 0, 100, 18)));
        panel.addChild(new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(130, 0, 18, 18)).setRenderItem(stackOut));
        list.addChild(panel);
    }
}
Also used : PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ItemStack(net.minecraft.item.ItemStack)

Aggregations

PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)62 Window (mcjty.lib.gui.Window)53 Panel (mcjty.lib.gui.widgets.Panel)47 Label (mcjty.lib.gui.widgets.Label)25 Argument (mcjty.lib.network.Argument)19 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)18 ResourceLocation (net.minecraft.util.ResourceLocation)18 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)16 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)15 Button (mcjty.lib.gui.widgets.Button)15 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)15 ItemStack (net.minecraft.item.ItemStack)15 Rectangle (java.awt.Rectangle)14 StyleConfig (mcjty.lib.base.StyleConfig)14 RFTools (mcjty.rftools.RFTools)14 java.awt (java.awt)13 TextField (mcjty.lib.gui.widgets.TextField)13 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)11 List (java.util.List)9 Slot (net.minecraft.inventory.Slot)9