Search in sources :

Example 1 with IBeeRoot

use of forestry.api.apiculture.IBeeRoot in project ForestryMC by ForestryMC.

the class ItemInventoryImprinter method getSelectedBee.

public IBee getSelectedBee() {
    IBeeRoot beeRoot = BeeManager.beeRoot;
    List<IBee> individualTemplates = beeRoot.getIndividualTemplates();
    Map<String, IAllele[]> genomeTemplates = beeRoot.getGenomeTemplates();
    IAllele[] templateActive = genomeTemplates.get(individualTemplates.get(primaryIndex).getIdent());
    IAllele[] templateInactive = genomeTemplates.get(individualTemplates.get(secondaryIndex).getIdent());
    IBeeGenome genome = beeRoot.templateAsGenome(templateActive, templateInactive);
    return new Bee(genome);
}
Also used : IAllele(forestry.api.genetics.IAllele) IBee(forestry.api.apiculture.IBee) Bee(forestry.apiculture.genetics.Bee) IBeeRoot(forestry.api.apiculture.IBeeRoot) IBee(forestry.api.apiculture.IBee) IBeeGenome(forestry.api.apiculture.IBeeGenome)

Example 2 with IBeeRoot

use of forestry.api.apiculture.IBeeRoot in project Binnie by ForestryMC.

the class AlvearyLogicHatchery method updateServer.

@Override
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
    if (tile.getWorldObj().rand.nextInt(2400) == 0) {
        final IBeeHousing house = tile.getMultiblockLogic().getController();
        if (!house.getErrorLogic().hasErrors()) {
            final ItemStack queenStack = house.getBeeInventory().getQueen();
            IBeeRoot beeRoot = Utils.getBeeRoot();
            final IBee queen = (queenStack.isEmpty()) ? null : beeRoot.getMember(queenStack);
            if (queen != null) {
                ItemStack larvae = beeRoot.getMemberStack(beeRoot.getBee(queen.getGenome()), EnumBeeType.LARVAE);
                for (int i = 0; i < 5; i++) {
                    if (inv.insertItem(i, larvae, false).isEmpty()) {
                        return;
                    }
                }
            }
        }
    }
}
Also used : IBeeHousing(forestry.api.apiculture.IBeeHousing) IBeeRoot(forestry.api.apiculture.IBeeRoot) IBee(forestry.api.apiculture.IBee) ItemStack(net.minecraft.item.ItemStack)

Example 3 with IBeeRoot

use of forestry.api.apiculture.IBeeRoot in project Binnie by ForestryMC.

the class AlvearyLogicFrameHousing method wearOutEquipment.

@Override
public void wearOutEquipment(final int amount) {
    IHiveFrame hiveFrame = this.getHiveFrame();
    if (hiveFrame != null) {
        IBeeRoot beeRoot = Utils.getBeeRoot();
        IMultiblockLogicAlveary multiblockLogic = tile.getMultiblockLogic();
        IAlvearyController alvearyController = multiblockLogic.getController();
        ItemStack queenStack = alvearyController.getBeeInventory().getQueen();
        IBee queen = beeRoot.getMember(queenStack);
        if (queen != null) {
            final int wear = Math.round(amount * 5 * beeRoot.getBeekeepingMode(tile.getWorldObj()).getWearModifier());
            ItemStack frame = inv.getStackInSlot(0);
            ItemStack frameUsed = hiveFrame.frameUsed(alvearyController, frame, queen, wear);
            inv.setStackInSlot(0, frameUsed);
        }
    }
}
Also used : IHiveFrame(forestry.api.apiculture.IHiveFrame) IAlvearyController(forestry.api.multiblock.IAlvearyController) IMultiblockLogicAlveary(forestry.api.multiblock.IMultiblockLogicAlveary) IBeeRoot(forestry.api.apiculture.IBeeRoot) IBee(forestry.api.apiculture.IBee) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IBee (forestry.api.apiculture.IBee)3 IBeeRoot (forestry.api.apiculture.IBeeRoot)3 ItemStack (net.minecraft.item.ItemStack)2 IBeeGenome (forestry.api.apiculture.IBeeGenome)1 IBeeHousing (forestry.api.apiculture.IBeeHousing)1 IHiveFrame (forestry.api.apiculture.IHiveFrame)1 IAllele (forestry.api.genetics.IAllele)1 IAlvearyController (forestry.api.multiblock.IAlvearyController)1 IMultiblockLogicAlveary (forestry.api.multiblock.IMultiblockLogicAlveary)1 Bee (forestry.apiculture.genetics.Bee)1