@Override protected boolean activateMachine() { List<?> entities = worldObj.getEntitiesWithinAABB( EntityAgeable.class, _areaManager.getHarvestArea().toAxisAlignedBB()); for (Object o : entities) { if (!(o instanceof EntityAgeable)) { continue; } EntityAgeable a = (EntityAgeable) o; if ((a.getGrowingAge() < 0 && !_moveOld) || (a.getGrowingAge() >= 0 && _moveOld)) { BlockPosition bp = BlockPosition.fromFactoryTile(this); bp.moveBackwards(1); a.setPosition(bp.x + 0.5, bp.y + 0.5, bp.z + 0.5); return true; } } setIdleTicks(getIdleTicksMax()); return false; }
public ItemStack compact(EntityLiving entity) { int id = EntityList.getEntityID(entity); ItemStack holder = new ItemStack(CompactMobsItems.fullMobHolder, 1); NBTTagCompound nbttag = holder.stackTagCompound; if (nbttag == null) { nbttag = new NBTTagCompound(); } nbttag.setInteger("entityId", id); if (entity instanceof EntityAgeable) { EntityAgeable entityAge = (EntityAgeable) entity; nbttag.setInteger("entityGrowingAge", entityAge.getGrowingAge()); } if (entity instanceof EntitySheep) { EntitySheep entitySheep = (EntitySheep) entity; nbttag.setBoolean("entitySheared", entitySheep.getSheared()); nbttag.setInteger("entityColor", entitySheep.getFleeceColor()); } if (CompactMobsCore.instance.useFullTagCompound) { NBTTagCompound entityTags = new NBTTagCompound(); NBTTagCompound var2 = new NBTTagCompound(); entity.writeToNBT(var2); nbttag.setCompoundTag("entityTags", var2); CompactMobsCore.instance.cmLog.info(var2.toString()); } String name = entity.getEntityName(); nbttag.setString("name", name); holder.setItemDamage(id); holder.setTagCompound(nbttag); entity.worldObj.removeEntity(entity); return holder; }