use of powercrystals.minefactoryreloaded.api.ISyringe in project MineFactoryReloaded by powercrystals.
the class TileEntityVet method activateMachine.
@Override
public boolean activateMachine() {
List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
for (Object o : entities) {
if (!(o instanceof EntityLiving) || o instanceof EntityPlayer || o instanceof EntityMob) {
continue;
}
EntityLiving e = (EntityLiving) o;
for (int i = 0; i < getSizeInventory(); i++) {
ItemStack s = getStackInSlot(i);
if (s != null && s.getItem() instanceof ISyringe) {
if (((ISyringe) s.getItem()).canInject(worldObj, e, s)) {
if (((ISyringe) s.getItem()).inject(worldObj, e, s)) {
s.itemID = MineFactoryReloadedCore.syringeEmptyItem.itemID;
return true;
}
}
}
}
}
setIdleTicks(getIdleTicksMax());
return false;
}
Aggregations