use of net.minecraft.entity.EntityAgeable in project PneumaticCraft by MineMaarten.
the class ProgWidgetEntityRightClick method getWidgetAI.
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget) {
return new DroneEntityBase<IProgWidget, EntityLivingBase>(drone, widget) {
private final List<Entity> visitedEntities = new ArrayList<Entity>();
@Override
protected boolean isEntityValid(Entity entity) {
return entity instanceof EntityLivingBase && !visitedEntities.contains(entity);
}
@Override
protected boolean doAction() {
visitedEntities.add(targetedEntity);
boolean activated = false;
ItemStack stack = drone.getInventory().getStackInSlot(0);
if (stack != null && stack.getItem().itemInteractionForEntity(stack, drone.getFakePlayer(), targetedEntity)) {
activated = true;
}
if (!activated && targetedEntity instanceof EntityAgeable && ((EntityAgeable) targetedEntity).interact(drone.getFakePlayer())) {
activated = true;
}
DroneAIBlockInteract.transferToDroneFromFakePlayer(drone);
//return activated; <-- will right click as long as it's sucessfully activated.
return false;
}
};
}
use of net.minecraft.entity.EntityAgeable in project MineFactoryReloaded by powercrystals.
the class ItemSyringeGrowth method inject.
@Override
public boolean inject(World world, EntityLiving entity, ItemStack syringe) {
if (entity instanceof EntityAgeable) {
((EntityAgeable) entity).setGrowingAge(0);
} else {
EntityGiantZombie e = new EntityGiantZombie(world);
e.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
world.spawnEntityInWorld(e);
entity.setDead();
}
return true;
}
use of net.minecraft.entity.EntityAgeable in project MineFactoryReloaded by powercrystals.
the class ItemSyringeZombie method inject.
@Override
public boolean inject(World world, EntityLiving entity, ItemStack syringe) {
if (world.rand.nextInt(100) < 5) {
Entity e;
if (entity instanceof EntityPig) {
e = new EntityPigZombie(world);
} else {
e = new EntityZombie(world);
}
e.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
world.spawnEntityInWorld(e);
entity.setDead();
} else {
((EntityAgeable) entity).setGrowingAge(0);
}
return true;
}
use of net.minecraft.entity.EntityAgeable in project MineFactoryReloaded by powercrystals.
the class TileEntityChronotyper method activateMachine.
@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;
}
use of net.minecraft.entity.EntityAgeable in project NetherEx by LogicTechCorp.
the class EntityAIPigtificateMate method giveBirth.
private void giveBirth() {
EntityAgeable baby = pigtificate.createChild(mate);
mate.setGrowingAge(6000);
pigtificate.setGrowingAge(6000);
mate.setWillingToMate(false);
pigtificate.setWillingToMate(false);
final BabyEntitySpawnEvent event = new BabyEntitySpawnEvent(pigtificate, mate, baby);
if (MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) {
return;
}
baby = event.getChild();
baby.setGrowingAge(-24000);
baby.setLocationAndAngles(pigtificate.posX, pigtificate.posY, pigtificate.posZ, 0.0F, 0.0F);
world.spawnEntity(baby);
world.setEntityState(baby, (byte) 12);
}
Aggregations