use of powercrystals.minefactoryreloaded.api.IFactoryRanchable in project MineFactoryReloaded by powercrystals.
the class TileEntityRancher method activateMachine.
@Override
public boolean activateMachine() {
MFRLiquidMover.pumpLiquid(_tank, this);
boolean didDrop = false;
List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
for (Object o : entities) {
EntityLiving e = (EntityLiving) o;
if (MFRRegistry.getRanchables().containsKey(e.getClass())) {
IFactoryRanchable r = MFRRegistry.getRanchables().get(e.getClass());
List<ItemStack> drops = r.ranch(worldObj, e, this);
if (drops != null) {
for (ItemStack s : drops) {
if (LiquidContainerRegistry.isLiquid(s)) {
_tank.fill(new LiquidStack(s.itemID, LiquidContainerRegistry.BUCKET_VOLUME, s.getItemDamage()), true);
didDrop = true;
continue;
}
doDrop(s);
didDrop = true;
}
if (didDrop) {
setIdleTicks(20);
return true;
}
}
}
}
setIdleTicks(getIdleTicksMax());
return false;
}
Aggregations