public void setTarget(LivingEntity target) { EntityCreature entity = getHandle(); if (target == null) { entity.target = null; entity.setGoalTarget(null); } else if (target instanceof CraftLivingEntity) { entity.target = ((CraftLivingEntity) target).getHandle(); entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F, true, false, false, true); entity.setGoalTarget(((CraftLivingEntity) target).getHandle()); } }
public void setTarget(LivingEntity target) { EntityCreature entity = getHandle(); if (target == null) { entity.setGoalTarget(null, null, false); } else if (target instanceof CraftLivingEntity) { entity.setGoalTarget(((CraftLivingEntity) target).getHandle(), null, false); } }
public void setTarget(LivingEntity target) { EntityCreature entity = getHandle(); if (target == null) { entity.target = null; } else if (target instanceof CraftLivingEntity) { entity.target = ((CraftLivingEntity) target).getHandle(); entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F, true, false, false, true); } }
/** * Initializes an entities type on construction to specify what group this * entity is in for activation ranges. * * @param entity * @return group id */ public static byte initializeEntityActivationType(Entity entity) { if ( entity instanceof EntityMonster || entity instanceof EntitySlime ) { return 1; // Monster } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbient ) { return 2; // Animal } else { return 3; // Misc } }
public CraftCreature(CraftServer server, EntityCreature entity) { super(server, entity); }
@Override public EntityCreature getHandle() { return (EntityCreature) entity; }
/** * If an entity is not in range, do some more checks to see if we should * give it a shot. * * @param entity * @return */ public static boolean checkEntityImmunities(Entity entity) { // quick checks. if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 ) { return true; } if ( !( entity instanceof EntityArrow ) ) { if ( !entity.onGround || entity.passenger != null || entity.vehicle != null ) { return true; } } else if ( !( (EntityArrow) entity ).inGround ) { return true; } // special cases. if ( entity instanceof EntityLiving ) { EntityLiving living = (EntityLiving) entity; if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) { return true; } if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null ) { return true; } if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bU() /* Getter for first boolean */ ) { return true; } if ( entity instanceof EntityAnimal ) { EntityAnimal animal = (EntityAnimal) entity; if ( animal.isBaby() || animal.bY() /*love*/ ) { return true; } if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).isSheared() ) { return true; } } } return false; }
/** * If an entity is not in range, do some more checks to see if we should * give it a shot. * * @param entity * @return */ public static boolean checkEntityImmunities(Entity entity) { // quick checks. if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 ) { return true; } if ( !( entity instanceof EntityArrow ) ) { if ( !entity.onGround || entity.passenger != null || entity.vehicle != null ) { return true; } } else if ( !( (EntityArrow) entity ).inGround ) { return true; } // special cases. if ( entity instanceof EntityLiving ) { EntityLiving living = (EntityLiving) entity; if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) { return true; } if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null ) { return true; } if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bY() /* Getter for first boolean */ ) { return true; } if ( entity instanceof EntityAnimal ) { EntityAnimal animal = (EntityAnimal) entity; if ( animal.isBaby() || animal.ce() /*love*/ ) { return true; } if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).isSheared() ) { return true; } } } return false; }
/** * If an entity is not in range, do some more checks to see if we should * give it a shot. * * @param entity * @return */ public static boolean checkEntityImmunities(Entity entity) { // quick checks. if ( entity.inWater || entity.fireTicks > 0 ) { return true; } if ( !( entity instanceof EntityArrow ) ) { if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() ) { return true; } } else if ( !( (EntityArrow) entity ).inGround ) { return true; } // special cases. if ( entity instanceof EntityLiving ) { EntityLiving living = (EntityLiving) entity; if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 ) { return true; } if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null ) { return true; } if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).db()/* Getter for first boolean */ ) { return true; } if ( entity instanceof EntityAnimal ) { EntityAnimal animal = (EntityAnimal) entity; if ( animal.isBaby() || animal.isInLove() ) { return true; } if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).isSheared() ) { return true; } } if (entity instanceof EntityCreeper && ((EntityCreeper) entity).isIgnited()) { // isExplosive return true; } } return false; }