Search in sources :

Example 1 with IHiveFrame

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

the class InventoryApiary method getFrames.

public Collection<Tuple<IHiveFrame, ItemStack>> getFrames() {
    Collection<Tuple<IHiveFrame, ItemStack>> hiveFrames = new ArrayList<>(SLOT_FRAMES_COUNT);
    for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
        ItemStack stackInSlot = getStackInSlot(i);
        Item itemInSlot = stackInSlot.getItem();
        if (itemInSlot instanceof IHiveFrame) {
            IHiveFrame frame = (IHiveFrame) itemInSlot;
            hiveFrames.add(new Tuple<>(frame, stackInSlot.copy()));
        }
    }
    return hiveFrames;
}
Also used : IHiveFrame(forestry.api.apiculture.IHiveFrame) Item(net.minecraft.item.Item) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) Tuple(net.minecraft.util.Tuple)

Example 2 with IHiveFrame

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

the class TileApiary method getBeeModifiers.

@Override
public Collection<IBeeModifier> getBeeModifiers() {
    List<IBeeModifier> beeModifiers = new ArrayList<>();
    beeModifiers.add(beeModifier);
    for (Tuple<IHiveFrame, ItemStack> frame : inventory.getFrames()) {
        IHiveFrame hiveFrame = frame.getFirst();
        ItemStack stack = frame.getSecond();
        IBeeModifier beeModifier = hiveFrame.getBeeModifier(stack);
        beeModifiers.add(beeModifier);
    }
    return beeModifiers;
}
Also used : IHiveFrame(forestry.api.apiculture.IHiveFrame) IBeeModifier(forestry.api.apiculture.IBeeModifier) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack)

Example 3 with IHiveFrame

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

the class InventoryApiary method wearOutFrames.

@Override
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
    IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorldObj());
    int wear = Math.round(amount * beekeepingMode.getWearModifier());
    for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
        ItemStack hiveFrameStack = getStackInSlot(i);
        Item hiveFrameItem = hiveFrameStack.getItem();
        if ((hiveFrameItem instanceof IHiveFrame)) {
            IHiveFrame hiveFrame = (IHiveFrame) hiveFrameItem;
            ItemStack queenStack = getQueen();
            IBee queen = BeeManager.beeRoot.getMember(queenStack);
            if (queen != null) {
                ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear);
                setInventorySlotContents(i, usedFrame);
            }
        }
    }
}
Also used : IHiveFrame(forestry.api.apiculture.IHiveFrame) Item(net.minecraft.item.Item) IBeekeepingMode(forestry.api.apiculture.IBeekeepingMode) IBee(forestry.api.apiculture.IBee) ItemStack(net.minecraft.item.ItemStack)

Example 4 with IHiveFrame

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

the class EntityMinecartApiary method getBeeModifiers.

@Override
public Collection<IBeeModifier> getBeeModifiers() {
    List<IBeeModifier> beeModifiers = new ArrayList<>();
    beeModifiers.add(beeModifier);
    for (Tuple<IHiveFrame, ItemStack> frame : inventory.getFrames()) {
        IHiveFrame hiveFrame = frame.getFirst();
        ItemStack stack = frame.getSecond();
        IBeeModifier beeModifier = hiveFrame.getBeeModifier(stack);
        beeModifiers.add(beeModifier);
    }
    return beeModifiers;
}
Also used : IHiveFrame(forestry.api.apiculture.IHiveFrame) IBeeModifier(forestry.api.apiculture.IBeeModifier) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack)

Example 5 with IHiveFrame

use of forestry.api.apiculture.IHiveFrame 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

IHiveFrame (forestry.api.apiculture.IHiveFrame)5 ItemStack (net.minecraft.item.ItemStack)5 ArrayList (java.util.ArrayList)3 IBee (forestry.api.apiculture.IBee)2 IBeeModifier (forestry.api.apiculture.IBeeModifier)2 Item (net.minecraft.item.Item)2 IBeeRoot (forestry.api.apiculture.IBeeRoot)1 IBeekeepingMode (forestry.api.apiculture.IBeekeepingMode)1 IAlvearyController (forestry.api.multiblock.IAlvearyController)1 IMultiblockLogicAlveary (forestry.api.multiblock.IMultiblockLogicAlveary)1 Tuple (net.minecraft.util.Tuple)1