diff options
Diffstat (limited to 'nms-patches/ItemBow.patch')
-rw-r--r-- | nms-patches/ItemBow.patch | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch index b21506f0..64e6fd71 100644 --- a/nms-patches/ItemBow.patch +++ b/nms-patches/ItemBow.patch @@ -7,43 +7,38 @@ + public class ItemBow extends Item { - public static final String[] a = new String[] { "pulling_0", "pulling_1", "pulling_2"}; -@@ -45,9 +47,28 @@ - } + public ItemBow() { +@@ -73,7 +75,20 @@ + } - if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) { -- entityarrow.setOnFire(100); -+ // CraftBukkit start - call EntityCombustEvent -+ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); -+ entityarrow.world.getServer().getPluginManager().callEvent(event); + if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) { +- entityarrow.setOnFire(100); ++ // CraftBukkit start - call EntityCombustEvent ++ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); ++ entityarrow.world.getServer().getPluginManager().callEvent(event); + -+ if (!event.isCancelled()) { -+ entityarrow.setOnFire(event.getDuration()); -+ } -+ // CraftBukkit end -+ } -+ -+ // CraftBukkit start -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f); -+ if (event.isCancelled()) { -+ event.getProjectile().remove(); -+ return; - } ++ if (!event.isCancelled()) { ++ entityarrow.setOnFire(event.getDuration()); ++ } ++ // CraftBukkit end ++ } ++ // CraftBukkit start ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f); ++ if (event.isCancelled()) { ++ event.getProjectile().remove(); ++ return; + } -+ if (event.getProjectile() == entityarrow.getBukkitEntity()) { -+ world.addEntity(entityarrow); -+ } -+ // CraftBukkit end -+ - itemstack.damage(1, entityhuman); - world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (ItemBow.g.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - if (flag) { -@@ -58,7 +79,7 @@ + itemstack.damage(1, entityhuman); +@@ -81,7 +96,10 @@ + entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY; + } - entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); - if (!world.isClientSide) { -- world.addEntity(entityarrow); -+ // world.addEntity(entityarrow); // CraftBukkit - moved up - } - } +- world.addEntity(entityarrow); ++ if (event.getProjectile() == entityarrow.getBukkitEntity()) { ++ world.addEntity(entityarrow); ++ } ++ // CraftBukkit end + } + world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.v, SoundCategory.NEUTRAL, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); |