Search in sources :

Example 46 with PositionalLayout

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

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

the class GuiInvChecker method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    amountField = new TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14)).addTextEvent((parent, newText) -> setAmount());
    int amount = tileEntity.getAmount();
    amountField.setText(String.valueOf(amount));
    slotField = new TextField(mc, this).setTooltips("Set the slot index").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setSlot());
    int current = tileEntity.getSlot();
    slotField.setText(String.valueOf(current));
    metaLabel = new ChoiceLabel(mc, this).addChoices(META_IGNORE, META_MATCH).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(META_IGNORE, "Ignore meta/damage on item").setChoiceTooltip(META_MATCH, "Meta/damage on item must match");
    metaLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
    metaLabel.setChoice(tileEntity.isUseMeta() ? META_MATCH : META_IGNORE);
    oreDictLabel = new ChoiceLabel(mc, this).addChoices(OREDICT_IGNORE, OREDICT_USE).addChoiceEvent((parent, newChoice) -> setOredictUsage()).setChoiceTooltip(OREDICT_IGNORE, "Ingore ore dictionary").setChoiceTooltip(OREDICT_USE, "Use ore dictionary matching");
    oreDictLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 51, 80, 14));
    oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
    toplevel.addChild(new Label(mc, this).setText("Slot:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(slotField).addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Meta:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(metaLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 51, 50, 14))).addChild(oreDictLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) Window(mcjty.lib.gui.Window) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) TextField(mcjty.lib.gui.widgets.TextField)

Example 48 with PositionalLayout

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

the class GuiCoalGenerator 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 49 with PositionalLayout

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

the class GuiMachineInfuser 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());
    // arrow = new ImageLabel(mc, this).setImage(iconGuiElements, 192, 0);
    // arrow.setLayoutHint(new PositionalLayout.PositionalHint(90, 26, 16, 16));
    // .addChild(arrow);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
// tileEntity.requestResearchingFromServer();
}
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 50 with PositionalLayout

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

the class GuiItemFilter method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int[] inputMode = tileEntity.getInputMode();
    int[] outputMode = tileEntity.getOutputMode();
    for (EnumFacing direction : EnumFacing.VALUES) {
        final int side = direction.ordinal();
        for (int slot = 0; slot < ItemFilterContainer.BUFFER_SIZE; slot++) {
            ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25 + slot * 18, 4 + side * 13, 12, 12)).addChoice("0", "Disabled", iconGuiElements, 160, 0).addChoice("1", "Input", iconGuiElements, 96, 16).addChoice("2", "Output", iconGuiElements, 80, 16);
            bits[side * ItemFilterContainer.BUFFER_SIZE + slot] = choiceLabel;
            if ((inputMode[side] & (1 << slot)) != 0) {
                choiceLabel.setCurrentChoice(1);
            } else if ((outputMode[side] & (1 << slot)) != 0) {
                choiceLabel.setCurrentChoice(2);
            } else {
                choiceLabel.setCurrentChoice(0);
            }
            final int finalSlot = slot;
            choiceLabel.addChoiceEvent((parent, newChoice) -> changeMode(side, finalSlot));
            toplevel.addChild(choiceLabel);
        }
    }
    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) EnumFacing(net.minecraft.util.EnumFacing) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

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 Button (mcjty.lib.gui.widgets.Button)16 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)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 Slot (net.minecraft.inventory.Slot)10 List (java.util.List)9