use of forestry.api.apiculture.IBeeHousingInventory in project ForestryMC by ForestryMC.
the class BeekeepingLogic method tickBreed.
// / BREEDING
private void tickBreed() {
beeProgressMax = totalBreedingTime;
IBeeHousingInventory beeInventory = housing.getBeeInventory();
ItemStack droneStack = beeInventory.getDrone();
ItemStack princessStack = beeInventory.getQueen();
EnumBeeType droneType = BeeManager.beeRoot.getType(droneStack);
EnumBeeType princessType = BeeManager.beeRoot.getType(princessStack);
if (droneType != EnumBeeType.DRONE || princessType != EnumBeeType.PRINCESS) {
beeProgress = 0;
return;
}
if (beeProgress < totalBreedingTime) {
beeProgress++;
}
if (beeProgress < totalBreedingTime) {
return;
}
// Mate and replace princess with queen
IBee princess = BeeManager.beeRoot.getMember(princessStack);
IBee drone = BeeManager.beeRoot.getMember(droneStack);
princess.mate(drone);
NBTTagCompound nbttagcompound = new NBTTagCompound();
princess.writeToNBT(nbttagcompound);
queenStack = new ItemStack(ModuleApiculture.getItems().beeQueenGE);
queenStack.setTagCompound(nbttagcompound);
beeInventory.setQueen(queenStack);
// Register the new queen with the breeding tracker
BeeManager.beeRoot.getBreedingTracker(housing.getWorldObj(), housing.getOwner()).registerQueen(princess);
// Remove drone
beeInventory.getDrone().shrink(1);
// Reset breeding time
queen = princess;
beeProgress = princess.getHealth();
beeProgressMax = princess.getMaxHealth();
}
Aggregations