Search in sources :

Example 6 with ControlPlayerInventory

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

the class WindowGeneBank method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    this.addEventHandler(EventValueChanged.class, event -> {
        if (event.getValue() instanceof BreedingSystem) {
            WindowGeneBank.this.genes.setValue((IBreedingSystem) event.getValue());
        }
    });
    int x = 16;
    final int y = 32;
    new ControlPlayerInventory(this, x, y);
    x += 124;
    int boxX = x;
    final int geneBoxWidth = 120;
    new Panel(this, boxX + 24, 32, geneBoxWidth, 120, MinecraftGUI.PanelType.BLACK);
    new Panel(this, boxX + 24 + geneBoxWidth, 32, 14, 120, MinecraftGUI.PanelType.GRAY);
    final ControlScrollableContent<ControlGeneScroll> scroll = new ControlScrollableContent<>(this, boxX + 24 + 2, 34, geneBoxWidth + 10, 116, 12);
    final ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18, 80, 12);
    this.addEventHandler(EventTextEdit.class, EventHandlerOrigin.SELF, edit, event -> {
        String value = event.getValue();
        if (value == null) {
            value = "";
        }
        WindowGeneBank.this.genes.setFilter(value);
    });
    this.genes = new ControlGeneScroll(scroll, 1, 1, geneBoxWidth, 116);
    scroll.setScrollableContent(this.genes);
    this.genes.setGenes(Binnie.GENETICS.getFirstActiveSystem());
    final ControlTabBar<IBreedingSystem> tabBar = new GeneBankTabBar(this, boxX);
    tabBar.setValue(Binnie.GENETICS.getFirstActiveSystem());
    boxX -= 8;
    final ControlTabBar<String> infoTabs = new ControlTabBar<>(this, boxX + 8, 160, 16, 50, Alignment.LEFT, Arrays.asList("Info", "Stats", "Ranking"));
    final Panel panelProject = new Panel(this, boxX + 24, 160, geneBoxWidth + 20, 50, MinecraftGUI.PanelType.BLACK);
    int totalGenes = 0;
    int seqGenes = 0;
    for (final IBreedingSystem system : Binnie.GENETICS.getActiveSystems()) {
        final GeneTracker tracker = GeneTracker.getTracker(this.getWorld(), this.getUsername());
        final Map<IChromosomeType, List<IAllele>> genes = Binnie.GENETICS.getChromosomeMap(system.getSpeciesRoot());
        for (final Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
            totalGenes += entry.getValue().size();
            for (final IAllele allele : entry.getValue()) {
                final Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
                if (tracker.isSequenced(gene)) {
                    ++seqGenes;
                }
            }
        }
    }
    new ControlText(panelProject, new Point(4, 4), "§nFull Genome Project");
    new ControlText(panelProject, new Point(4, 18), "§oSequenced §r" + seqGenes + '/' + totalGenes + " §oGenes");
}
Also used : BreedingSystem(binnie.core.genetics.BreedingSystem) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) ControlTextEdit(binnie.core.gui.controls.ControlTextEdit) ControlText(binnie.core.gui.controls.ControlText) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) Point(binnie.core.gui.geometry.Point) Point(binnie.core.gui.geometry.Point) ControlTabBar(binnie.core.gui.controls.tab.ControlTabBar) IAllele(forestry.api.genetics.IAllele) Panel(binnie.core.gui.window.Panel) Gene(binnie.core.genetics.Gene) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) List(java.util.List) IChromosomeType(forestry.api.genetics.IChromosomeType) GeneTracker(binnie.genetics.genetics.GeneTracker) Map(java.util.Map) ControlScrollableContent(binnie.core.gui.controls.scroll.ControlScrollableContent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 7 with ControlPlayerInventory

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

the class WindowFieldKit method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    this.setTitle(I18N.localise("binniecore.gui.fieldkit.title"));
    CraftGUI.RENDER.setStyleSheet(StyleSheetManager.getSheet(StyleSheetManager.PUNNETT_SHEET));
    WindowInventory inventory = this.getWindowInventory();
    inventory.createSlot(INDIVIDUAL_SLOT);
    inventory.createSlot(PAPER_SLOT);
    this.setupValidators();
    new ControlPlayerInventory(this);
    final Point handGlass = new Point(16, 32);
    this.GlassControl = new ControlImage(this, handGlass.xPos(), handGlass.yPos(), new StandardTexture(0, 160, 96, 96, BinnieCoreTexture.GUI_PUNNETT));
    new ControlSlot.Builder(this, handGlass.xPos() + 54, handGlass.yPos() + 26).assign(InventoryType.WINDOW, 0);
    new ControlSlot.Builder(this, 208, 8).assign(InventoryType.WINDOW, 1);
    (this.text = new ControlText(this, new Point(232, 13), I18N.localise("binniecore.gui.fieldkit.paper"))).setColor(2236962);
    (this.text = new ControlText(this, new Area(0, 120, this.getWidth(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962);
    this.chromo = new ControlChromosome(this, 150, 24);
    this.addEventHandler(EventValueChanged.class, EventHandlerOrigin.DIRECT_CHILD, this.chromo, event -> {
        final IChromosomeType type = (IChromosomeType) event.getValue();
        if (type != null && WindowFieldKit.this.info.containsKey(type)) {
            final String t = WindowFieldKit.this.info.get(type);
            WindowFieldKit.this.text.setValue(t);
        } else {
            WindowFieldKit.this.text.setValue("");
        }
    });
}
Also used : StandardTexture(binnie.core.gui.resource.textures.StandardTexture) Area(binnie.core.gui.geometry.Area) WindowInventory(binnie.core.gui.minecraft.WindowInventory) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlText(binnie.core.gui.controls.ControlText) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) Point(binnie.core.gui.geometry.Point) ControlImage(binnie.core.gui.minecraft.control.ControlImage) IChromosomeType(forestry.api.genetics.IChromosomeType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with ControlPlayerInventory

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

the class WindowInoculator method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    final int y = 32;
    new ControlLiquidTank(this, x, y + 18 + 16, Inoculator.TANK_VEKTOR);
    CraftGUIUtil.horizontalGrid(x, y, new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(0), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED));
    x += 18;
    new ControlMachineProgress(this, x, y + 24, PROGRESS_BASE, PROGRESS, Alignment.LEFT);
    new ControlEnergyBar(this, 91, 118, 60, 16, Alignment.LEFT);
    new ControlErrorState(this, 161, 118);
    x += 142;
    CraftGUIUtil.verticalGrid(x, y, TextJustification.MIDDLE_LEFT, 8, new ControlSlotArray.Builder(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlSlot.Builder(this, x, y + 18 + 8).assign(9), new ControlSlotArray.Builder(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED));
    new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ARROW_UP_LEFT.getIcon().getResourceLocation());
    new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ARROW_LEFT_DOWN.getIcon().getResourceLocation());
    new ControlPlayerInventory(this);
}
Also used : ControlIconDisplay(binnie.core.gui.minecraft.control.ControlIconDisplay) ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlMachineProgress(binnie.core.gui.minecraft.control.ControlMachineProgress) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlLiquidTank(binnie.core.gui.minecraft.control.ControlLiquidTank) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 9 with ControlPlayerInventory

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

the class WindowIsolator method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    final int y = 32;
    new ControlLiquidTank(this, x, y, Isolator.TANK_ETHANOL);
    x += 26;
    new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
    x += 20;
    new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 18;
    new ControlSlot.Builder(this, x, y + 3).assign(5);
    new ControlSlot.Builder(this, x, y + 36 + 3).assign(0);
    new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(15722671);
    x += 18;
    new ControlProgress(this, x, y + 3, PROGRESS_BASE, PROGRESS, Alignment.LEFT);
    x += 142;
    new ControlSlot.Builder(this, x, y + 3).assign(6);
    new ControlSlot.Builder(this, x, y + 3 + 36).assign(1);
    new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ARROW_UP.getIcon().getResourceLocation());
    x += 20;
    new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 18;
    new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
    new ControlEnergyBar(this, 260, 130, 16, 60, Alignment.BOTTOM);
    new ControlErrorState(this, 153, 81);
    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) 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) ControlProgress(binnie.core.gui.minecraft.control.ControlProgress) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 10 with ControlPlayerInventory

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

the class WindowGenepool method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    final int y = 32;
    new ControlLiquidTank(this, x, y, Genepool.TANK_ETHANOL);
    x += 26;
    new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
    x += 38;
    new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation());
    x += 18;
    new ControlSlot.Builder(this, x, y + 3 + 18).assign(0);
    x += 18;
    new ControlMachineProgress(this, x, y + 19, PROGRESS_BASE, PROGRESS, Alignment.LEFT);
    x += 130;
    new ControlLiquidTank(this, x, y, Genepool.TANK_DNA);
    new ControlEnergyBar(this, 21, 115, 16, 60, Alignment.BOTTOM);
    new ControlSlot.Builder(this, 121, 82).assign(7);
    new ControlSlotCharge(this, 143, 82, 7).setColor(15722671);
    new ControlErrorState(this, 181, 83);
    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)

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