Search in sources :

Example 6 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem in project Binnie by ForestryMC.

the class ControlMutationSymbol method setValue.

public void setValue(final IMutation value) {
    this.value = value;
    final boolean isMaster = ((WindowAbstractDatabase) this.getTopParent()).isMaster();
    final IBreedingSystem system = ((WindowAbstractDatabase) this.getTopParent()).getBreedingSystem();
    this.discovered = (isMaster || system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername()));
    if (this.discovered) {
        this.setColor(16777215);
    } else {
        this.setColor(7829367);
    }
}
Also used : IBreedingSystem(binnie.core.api.genetics.IBreedingSystem)

Example 7 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem in project Binnie by ForestryMC.

the class PageBreeder method onPageRefresh.

public void onPageRefresh() {
    this.deleteAllChildren();
    final IBreedingSystem system = ((WindowAbstractDatabase) Window.get(this)).getBreedingSystem();
    new ControlTextCentered(this, 8, TextFormatting.UNDERLINE + system.getDescriptor() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".profile"));
    new ControlTextCentered(this, 75, system.getDiscoveredSpeciesCount() + '/' + system.getTotalSpeciesCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".species"));
    new ControlBreedingProgress(this, 20, 87, 102, 14, system, system.getDiscoveredSpeciesPercentage());
    new ControlTextCentered(this, 115, system.getDiscoveredBranchCount() + '/' + system.getTotalBranchCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".branches"));
    new ControlBreedingProgress(this, 20, 127, 102, 14, system, system.getDiscoveredBranchPercentage());
    if (system.getDiscoveredSecretCount() > 0) {
        new ControlTextCentered(this, 155, system.getDiscoveredSecretCount() + '/' + system.getTotalSecretCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".species.secret"));
    }
    new ControlTextCentered(this, 32, this.player.getName());
    new ControlTextCentered(this, 44, TextFormatting.ITALIC + system.getEpitome());
}
Also used : IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) ControlTextCentered(binnie.core.gui.controls.ControlTextCentered)

Example 8 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem in project Binnie by ForestryMC.

the class GeneArrayItem method getInfo.

@Override
@SideOnly(Side.CLIENT)
public void getInfo(List<String> list) {
    List<String> totalList = new ArrayList<>();
    IBreedingSystem breedingSystem = getBreedingSystem();
    if (breedingSystem != null) {
        for (IGene gene : genes) {
            String chromosomeName = breedingSystem.getChromosomeName(gene.getChromosome());
            totalList.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName());
        }
    }
    if (totalList.size() < 4 || GuiScreen.isShiftKeyDown()) {
        list.addAll(totalList);
    } else {
        list.add(totalList.get(0));
        list.add(totalList.get(1));
        list.add((totalList.size() - 2) + " " + I18N.localise("genetics.item.gene.more.genes"));
    }
}
Also used : ArrayList(java.util.ArrayList) IGene(binnie.core.api.genetics.IGene) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 9 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem 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 10 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem in project Binnie by ForestryMC.

the class WindowAnalyst method initialiseServer.

@Override
public void initialiseServer() {
    for (IBreedingSystem system : Binnie.GENETICS.getActiveSystems()) {
        ISpeciesRoot root = system.getSpeciesRoot();
        if (root != null) {
            IBreedingTracker tracker = root.getBreedingTracker(getWorld(), getUsername());
            if (tracker != null) {
                tracker.synchToPlayer(getPlayer());
            }
        }
    }
    // create slots
    getWindowInventory().createSlot(0);
    getWindowInventory().createSlot(1);
    setupValidators();
}
Also used : ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) IBreedingTracker(forestry.api.genetics.IBreedingTracker) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem)

Aggregations

IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)22 ArrayList (java.util.ArrayList)8 IAllele (forestry.api.genetics.IAllele)7 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)6 IChromosomeType (forestry.api.genetics.IChromosomeType)5 IIndividual (forestry.api.genetics.IIndividual)5 ItemStack (net.minecraft.item.ItemStack)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)4 Gene (binnie.core.genetics.Gene)3 Point (binnie.core.gui.geometry.Point)3 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)3 List (java.util.List)3 IGene (binnie.core.api.genetics.IGene)2 BreedingSystem (binnie.core.genetics.BreedingSystem)2 ControlText (binnie.core.gui.controls.ControlText)2 Control (binnie.core.gui.controls.core.Control)2 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)2 Area (binnie.core.gui.geometry.Area)2 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)2