Search in sources :

Example 1 with ControlPlayerInventory

use of binnie.core.gui.minecraft.control.ControlPlayerInventory in project Binnie by ForestryMC.

the class WindowGenesis method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    new ControlPlayerInventory(this);
    this.setTitle(I18N.localise("binniecore.gui.genesis.title"));
    final ControlTabBar<IBreedingSystem> tabSystems = new GenesisTabSystems(this);
    this.root = Binnie.GENETICS.getActiveSystems().iterator().next().getSpeciesRoot();
    this.template = this.root.getDefaultTemplate();
    final Area one = new Area(32, 28, 170, 100);
    final Area two = new Area(214, 28, 100, 100);
    new Panel(this, one.outset(1), MinecraftGUI.PanelType.BLACK);
    new Panel(this, two.outset(1), MinecraftGUI.PanelType.BLACK);
    this.geneList = new GeneList(this, one);
    this.geneOptions = new GeneOptions(this, two);
    tabSystems.addEventHandler(EventValueChanged.class, EventHandlerOrigin.SELF, tabSystems, event -> {
        Object value = event.getValue();
        if (!(value instanceof BreedingSystem)) {
            return;
        }
        IBreedingSystem breedingSystem = (IBreedingSystem) value;
        root = breedingSystem.getSpeciesRoot();
        template = root.getDefaultTemplate();
        refreshTemplate(null);
    });
    this.geneList.addEventHandler(EventValueChanged.class, EventHandlerOrigin.SELF, this.geneList, event -> {
        Object value = event.getValue();
        if (!(value instanceof Gene)) {
            return;
        }
        Gene gene = (Gene) value;
        Map<IChromosomeType, List<IAllele>> map = Binnie.GENETICS.getChromosomeMap(root);
        List<Gene> options = new ArrayList<>();
        IChromosomeType chromosomeType = gene.getChromosome();
        List<IAllele> alleles = map.get(chromosomeType);
        for (IAllele allele : alleles) {
            options.add(new Gene(allele, chromosomeType, root));
        }
        geneOptions.setOptions(options);
    });
    this.geneOptions.addEventHandler(EventValueChanged.class, EventHandlerOrigin.SELF, this.geneOptions, event -> {
        Object value = event.getValue();
        if (!(value instanceof Gene)) {
            return;
        }
        Gene gene = (Gene) value;
        IChromosomeType chromosomeType = gene.getChromosome();
        ISpeciesRoot speciesRoot = gene.getSpeciesRoot();
        IAllele allele = gene.getAllele();
        if (chromosomeType == speciesRoot.getSpeciesChromosomeType()) {
            template = speciesRoot.getTemplate(allele.getUID());
        } else {
            template[chromosomeType.ordinal()] = allele;
        }
        refreshTemplate(chromosomeType);
    });
    this.panelPickup = new Panel(this, 16, 140, 60, 42, MinecraftGUI.PanelType.BLACK);
    this.refreshTemplate(null);
}
Also used : BreedingSystem(binnie.core.genetics.BreedingSystem) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) ArrayList(java.util.ArrayList) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) IAllele(forestry.api.genetics.IAllele) Panel(binnie.core.gui.window.Panel) Area(binnie.core.gui.geometry.Area) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) Gene(binnie.core.genetics.Gene) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ArrayList(java.util.ArrayList) List(java.util.List) IChromosomeType(forestry.api.genetics.IChromosomeType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with ControlPlayerInventory

use of binnie.core.gui.minecraft.control.ControlPlayerInventory in project Binnie by ForestryMC.

the class WindowAnalyst method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    setTitle(isDatabase ? (isMaster ? I18N.localise("genetics.gui.registry.master.title") : I18N.localise("genetics.gui.registry.title")) : I18N.localise("genetics.gui.analyst.title"));
    getWindowInventory().createSlot(0);
    baseWidget = new Widget(this);
    int x = 16;
    int y = 28;
    Collection<IBreedingSystem> activeSystems = Binnie.GENETICS.getActiveSystems();
    if (isDatabase) {
        for (IBreedingSystem syst : activeSystems) {
            new ControlSystemButton(x, y, this, syst);
            x += 22;
        }
    } else {
        new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.WINDOW, 0);
        x += 22;
        new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.WINDOW, 1);
        x += 26;
        setupValidators();
    }
    tabBar = new Control(this, x, 28, getWidth() - 16 - x, 20);
    analystPanel = new AnalystPanel(this);
    if (!isDatabase) {
        slideUpInv = new ControlSlide(this, (getSize().xPos() - 244) / 2, getSize().yPos() - 80 + 1, 244, 80, Alignment.BOTTOM);
        new ControlPlayerInventory(slideUpInv, true);
        slideUpInv.setSlide(false);
    }
    addEventHandler(EventKey.Down.class, event -> {
        if (event.getKey() == 205) {
            shiftPages(true);
        }
        if (event.getKey() == 203) {
            shiftPages(false);
        }
    });
    if (!isDatabase) {
        analystNone = new AnalystNoneControl(this);
    }
    setIndividual(null);
    IBreedingSystem first = Binnie.GENETICS.getFirstActiveSystem();
    setSystem(first);
}
Also used : IWidget(binnie.core.api.gui.IWidget) Widget(binnie.core.gui.Widget) ITitledWidget(binnie.core.api.gui.ITitledWidget) EventKey(binnie.core.gui.events.EventKey) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) Control(binnie.core.gui.controls.core.Control) ControlSlide(binnie.core.gui.minecraft.control.ControlSlide) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with ControlPlayerInventory

use of binnie.core.gui.minecraft.control.ControlPlayerInventory in project Binnie by ForestryMC.

the class WindowPolymeriser method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    final int y = 38;
    new ControlSlotArray.Builder(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
    new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 34;
    new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.PROGRESS_BASE, WindowPolymeriser.PROGRESS, Alignment.LEFT);
    new ControlSlot.Builder(this, x, y).assign(0);
    new ControlLiquidTank(this, x, y + 18 + 16, Polymeriser.TANK_BACTERIA, true);
    new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, Polymeriser.TANK_DNA, true);
    new ControlEnergyBar(this, x + 120, 96, 64, 16, Alignment.LEFT);
    x += 40;
    new ControlSlot.Builder(this, x + 30, y + 18 + 8).assign(1);
    new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(16766976);
    x += 138;
    new ControlSlotArray.Builder(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
    final ControlErrorState errorState = new ControlErrorState(this, 244, 97);
    new ControlPlayerInventory(this);
}
Also used : ControlIconDisplay(binnie.core.gui.minecraft.control.ControlIconDisplay) ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlSlotArray(binnie.core.gui.minecraft.control.ControlSlotArray) ControlMachineProgress(binnie.core.gui.minecraft.control.ControlMachineProgress) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) ControlSlotCharge(binnie.core.gui.minecraft.control.ControlSlotCharge) ControlLiquidTank(binnie.core.gui.minecraft.control.ControlLiquidTank) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with ControlPlayerInventory

use of binnie.core.gui.minecraft.control.ControlPlayerInventory in project Binnie by ForestryMC.

the class WindowSequencer method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    int y = 32;
    CraftGUIUtil.horizontalGrid(x, y, TextJustification.MIDDLE_CENTER, 2, new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(6));
    final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5);
    x = 34;
    y = 92;
    this.slotText = new ControlText(this, new Area(0, y, this.getWidth(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER);
    y += 20;
    final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0);
    x += 20;
    new ControlSlotCharge(this, x, y, 0).setColor(16750848);
    x += 32;
    new ControlEnergyBar(this, x, y, 60, 16, Alignment.LEFT);
    x += 92;
    final ControlErrorState errorState = new ControlErrorState(this, x, y + 1);
    new ControlPlayerInventory(this);
}
Also used : ControlIconDisplay(binnie.core.gui.minecraft.control.ControlIconDisplay) Area(binnie.core.gui.geometry.Area) ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlText(binnie.core.gui.controls.ControlText) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) ControlSlotCharge(binnie.core.gui.minecraft.control.ControlSlotCharge) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with ControlPlayerInventory

use of binnie.core.gui.minecraft.control.ControlPlayerInventory in project Binnie by ForestryMC.

the class WindowAnalyser method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    final int y = 32;
    new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
    x += 28;
    new ControlSlot.Builder(this, x, y + 54 + 8).assign(13);
    new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319);
    new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Alignment.LEFT);
    new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
    x -= 28;
    new ControlIconDisplay(this, x + 36 + 2, y + 18, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 56;
    new Panel(this, x, y, 76, 50, MinecraftGUI.PanelType.TINTED);
    new ControlProgress(this, x + 5, y + 5, PROGRESS_BASE, PROGRESS, Alignment.LEFT);
    new ControlSlot.Builder(this, x + 38 - 9, y + 25 - 9).assign(6);
    new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 96;
    new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
    x += 52;
    new ControlPlayerInventory(this);
}
Also used : ControlIconDisplay(binnie.core.gui.minecraft.control.ControlIconDisplay) Panel(binnie.core.gui.window.Panel) ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlSlotArray(binnie.core.gui.minecraft.control.ControlSlotArray) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) ControlSlotCharge(binnie.core.gui.minecraft.control.ControlSlotCharge) ControlProgress(binnie.core.gui.minecraft.control.ControlProgress) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)13 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)13 ControlErrorState (binnie.core.gui.minecraft.control.ControlErrorState)8 ControlSlot (binnie.core.gui.minecraft.control.ControlSlot)8 ControlEnergyBar (binnie.core.gui.minecraft.control.ControlEnergyBar)7 ControlIconDisplay (binnie.core.gui.minecraft.control.ControlIconDisplay)7 ControlSlotArray (binnie.core.gui.minecraft.control.ControlSlotArray)6 ControlText (binnie.core.gui.controls.ControlText)5 ControlSlotCharge (binnie.core.gui.minecraft.control.ControlSlotCharge)5 Panel (binnie.core.gui.window.Panel)5 Area (binnie.core.gui.geometry.Area)4 Point (binnie.core.gui.geometry.Point)4 ControlLiquidTank (binnie.core.gui.minecraft.control.ControlLiquidTank)4 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)3 ControlTextEdit (binnie.core.gui.controls.ControlTextEdit)3 ControlMachineProgress (binnie.core.gui.minecraft.control.ControlMachineProgress)3 IChromosomeType (forestry.api.genetics.IChromosomeType)3 BreedingSystem (binnie.core.genetics.BreedingSystem)2 Gene (binnie.core.genetics.Gene)2 Control (binnie.core.gui.controls.core.Control)2