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;
}
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;
}
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);
}
}
}
}
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;
}
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);
}
}
}
Aggregations