/** * EntityShootBowEvent */ public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) { LivingEntity shooter = (LivingEntity) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); Arrow arrow = (Arrow) entityArrow.getBukkitEntity(); if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) { itemInHand = null; } EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force); Bukkit.getPluginManager().callEvent(event); return event; }
public CraftArrow(CraftServer server, EntityArrow entity) { super(server, entity); }
@Override public EntityArrow getHandle() { return (EntityArrow) 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; }