Search in sources :

Example 1 with ImageChoiceLabel

use of mcjty.lib.gui.widgets.ImageChoiceLabel in project RFTools by McJty.

the class GuiCoalGenerator method initRedstoneMode.

private void initRedstoneMode() {
    redstoneMode = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeRedstoneMode()).addChoice(RedstoneMode.REDSTONE_IGNORED.getDescription(), "Redstone mode:\nIgnored", iconGuiElements, 0, 0).addChoice(RedstoneMode.REDSTONE_OFFREQUIRED.getDescription(), "Redstone mode:\nOff to activate", iconGuiElements, 16, 0).addChoice(RedstoneMode.REDSTONE_ONREQUIRED.getDescription(), "Redstone mode:\nOn to activate", iconGuiElements, 32, 0);
    redstoneMode.setLayoutHint(new PositionalLayout.PositionalHint(154, 46, 16, 16));
    redstoneMode.setCurrentChoice(tileEntity.getRSMode().ordinal());
}
Also used : PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

Example 2 with ImageChoiceLabel

use of mcjty.lib.gui.widgets.ImageChoiceLabel 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 3 with ImageChoiceLabel

use of mcjty.lib.gui.widgets.ImageChoiceLabel in project RFTools by McJty.

the class GuiBlockProtector method initRedstoneMode.

private void initRedstoneMode() {
    redstoneMode = new ImageChoiceLabel(mc, this);
    redstoneMode.addChoiceEvent((parent, newChoice) -> {
        changeRedstoneMode();
    });
    redstoneMode.addChoice(RedstoneMode.REDSTONE_IGNORED.getDescription(), "Redstone mode:\nIgnored", iconGuiElements, 0, 0);
    redstoneMode.addChoice(RedstoneMode.REDSTONE_OFFREQUIRED.getDescription(), "Redstone mode:\nOff to activate", iconGuiElements, 16, 0);
    redstoneMode.addChoice(RedstoneMode.REDSTONE_ONREQUIRED.getDescription(), "Redstone mode:\nOn to activate", iconGuiElements, 32, 0);
    redstoneMode.setLayoutHint(new PositionalLayout.PositionalHint(150, 46, 16, 16));
    redstoneMode.setCurrentChoice(tileEntity.getRSMode().ordinal());
}
Also used : PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

Example 4 with ImageChoiceLabel

use of mcjty.lib.gui.widgets.ImageChoiceLabel 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 5 with ImageChoiceLabel

use of mcjty.lib.gui.widgets.ImageChoiceLabel 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

ImageChoiceLabel (mcjty.lib.gui.widgets.ImageChoiceLabel)6 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)5 Window (mcjty.lib.gui.Window)3 Panel (mcjty.lib.gui.widgets.Panel)3 Argument (mcjty.lib.network.Argument)2 java.awt (java.awt)1 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)1 GenericTileEntity (mcjty.lib.entity.GenericTileEntity)1 EnergyBar (mcjty.lib.gui.widgets.EnergyBar)1 RFTools (mcjty.rftools.RFTools)1 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)1 Minecraft (net.minecraft.client.Minecraft)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 EnumFacing (net.minecraft.util.EnumFacing)1 EnumHand (net.minecraft.util.EnumHand)1 ResourceLocation (net.minecraft.util.ResourceLocation)1