Search in sources :

Example 6 with ControlText

use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.

the class PagePlanksTrees method onValueChanged.

@Override
public void onValueChanged(final ItemStack species) {
    this.deleteAllChildren();
    final WindowAbstractDatabase database = Window.get(this);
    new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
    final Collection<IAlleleSpecies> trees = getTreesThatMakePlanks(species, database.isMaster(), database.getWorld(), database.getUsername());
    new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
Also used : Area(binnie.core.gui.geometry.Area) ControlText(binnie.core.gui.controls.ControlText) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) WindowAbstractDatabase(binnie.core.gui.database.WindowAbstractDatabase) ControlSpeciesBox(binnie.core.gui.database.ControlSpeciesBox)

Example 7 with ControlText

use of binnie.core.gui.controls.ControlText 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 8 with ControlText

use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.

the class ControlTileSelect method refresh.

public void refresh(final String filterText) {
    this.deleteAllChildren();
    int cx = 2;
    int cy = 2;
    final Map<IDesignCategory, List<IDesign>> designs = new HashMap<>();
    for (final IDesignCategory category : DesignAPI.manager.getAllDesignCategories()) {
        designs.put(category, new ArrayList<>());
        for (final IDesign tile : category.getDesigns()) {
            if (Objects.equals(filterText, "") || tile.getName().toLowerCase().contains(filterText)) {
                designs.get(category).add(tile);
            }
        }
        if (designs.get(category).isEmpty()) {
            designs.remove(category);
        }
    }
    for (final IDesignCategory category : designs.keySet()) {
        cx = 2;
        new ControlText(this, new Point(cx, cy + 3), category.getName());
        cy += 16;
        for (final IDesign tile : designs.get(category)) {
            if (cx > 90) {
                cx = 2;
                cy += 20;
            }
            new ControlTile(this, cx, cy, tile);
            cx += 20;
        }
        cy += 20;
    }
    final int height = cy;
    this.setSize(new Point(this.getSize().xPos(), height));
}
Also used : IDesign(binnie.design.api.IDesign) HashMap(java.util.HashMap) ControlText(binnie.core.gui.controls.ControlText) ArrayList(java.util.ArrayList) List(java.util.List) Point(binnie.core.gui.geometry.Point) IDesignCategory(binnie.design.api.IDesignCategory) Point(binnie.core.gui.geometry.Point)

Example 9 with ControlText

use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.

the class AnalystPageBeeProducts method createProductEntry.

private void createProductEntry(ItemStack key, Float value, int y, float speed) {
    ControlItemDisplay item = new BeeProductItem(this, y, key);
    item.setTooltip();
    ControlText textWidget = new ControlTextCentered(this, y + 4, "");
    textWidget.setColor(getColor());
    CraftGUIUtil.moveWidget(textWidget, new Point(12, 0));
    item.setItemStack(key);
    int time = (int) (ModuleApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value));
    textWidget.setValue(I18N.localise(AnalystConstants.PRODUCTS_KEY + ".every") + ' ' + TimeUtil.getTimeString(time));
}
Also used : ControlItemDisplay(binnie.core.gui.minecraft.control.ControlItemDisplay) ControlText(binnie.core.gui.controls.ControlText) ControlTextCentered(binnie.core.gui.controls.ControlTextCentered) Point(binnie.core.gui.geometry.Point) Point(binnie.core.gui.geometry.Point)

Example 10 with ControlText

use of binnie.core.gui.controls.ControlText 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)

Aggregations

ControlText (binnie.core.gui.controls.ControlText)16 Area (binnie.core.gui.geometry.Area)10 Point (binnie.core.gui.geometry.Point)10 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)5 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)5 IAllele (forestry.api.genetics.IAllele)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)4 WindowAbstractDatabase (binnie.core.gui.database.WindowAbstractDatabase)4 ItemStack (net.minecraft.item.ItemStack)4 ControlTextEdit (binnie.core.gui.controls.ControlTextEdit)3 Control (binnie.core.gui.controls.core.Control)3 ControlSpeciesBox (binnie.core.gui.database.ControlSpeciesBox)3 ControlSlot (binnie.core.gui.minecraft.control.ControlSlot)3 Panel (binnie.core.gui.window.Panel)3 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)3 IChromosomeType (forestry.api.genetics.IChromosomeType)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)2