From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 15 Jun 2013 19:51:17 -0400 Subject: [PATCH] Improve EntityShootBowEvent Adds missing call to Illagers and also adds Arrow ItemStack to skeltons diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java index 54a4a295660375a0fcc54e02d80d569d9a32e73e..fee9a5140f097225b5da58b18bfbd528dffdc77b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java +++ b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java @@ -171,8 +171,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); + // Paper start + org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, entityliving.getRaisedHand(), 0.8F, true); + if (event.isCancelled()) { + event.getProjectile().remove(); + return; + } + + if (event.getProjectile() == entityarrow.getBukkitEntity()) { + this.world.addEntity(entityarrow); + } this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.world.addEntity(entityarrow); + // Paper end } class a extends EntityIllagerWizard.PathfinderGoalCastSpell { diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java index a2a67bccf38464731670e98cb155348df94474c5..4dca5ea9127c15b2739483b2ad74a5296a6b96ad 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java +++ b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java @@ -197,7 +197,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); // CraftBukkit start - org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); + org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); // Paper if (event.isCancelled()) { event.getProjectile().remove(); return;