diff --git a/Spigot-API-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/Spigot-API-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch index 02a702bca..7798907f7 100644 --- a/Spigot-API-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch +++ b/Spigot-API-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch @@ -9,42 +9,36 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java -@@ -0,0 +0,0 @@ package org.bukkit.event.entity; - - import org.bukkit.entity.Entity; - import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Projectile; // Paper - import org.bukkit.event.Cancellable; - import org.bukkit.event.HandlerList; - import org.bukkit.inventory.ItemStack; @@ -0,0 +0,0 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable { - private Entity projectile; private final float force; + private boolean consumeItem; private boolean cancelled; + // Paper start -+ private boolean consumeArrow = true; -+ private final ItemStack arrowItem; ++ @Deprecated + public void setConsumeArrow(boolean consumeArrow) { -+ this.consumeArrow = consumeArrow; -+ } -+ public boolean getConsumeArrow() { -+ return consumeArrow; -+ } - -+ @NotNull -+ public ItemStack getArrowItem() { -+ return arrowItem; ++ this.setConsumeItem(consumeArrow); + } + + @Deprecated - public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) { -+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force); ++ public boolean getConsumeArrow() { ++ return this.shouldConsumeItem(); + } + ++ @NotNull @Deprecated ++ public ItemStack getArrowItem() { ++ return this.getConsumable(); ++ } ++ ++ @Deprecated ++ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) { ++ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force); ++ } + ++ @Deprecated + public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Entity projectile, final float force) { ++ this(shooter, bow, arrowItem, projectile, EquipmentSlot.HAND, force, true); ++ } ++ // Paper end + public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @Nullable final ItemStack consumable, @NotNull final Entity projectile, @NotNull final EquipmentSlot hand, final float force, final boolean consumeItem) { super(shooter); -+ this.arrowItem = arrowItem; -+ // Paper end this.bow = bow; - this.projectile = projectile; - this.force = force; diff --git a/Spigot-Server-Patches/0554-Brand-support.patch b/Spigot-Server-Patches/0553-Brand-support.patch similarity index 100% rename from Spigot-Server-Patches/0554-Brand-support.patch rename to Spigot-Server-Patches/0553-Brand-support.patch diff --git a/Spigot-Server-Patches/0564-Brand-support.patch b/Spigot-Server-Patches/0563-Brand-support.patch similarity index 100% rename from Spigot-Server-Patches/0564-Brand-support.patch rename to Spigot-Server-Patches/0563-Brand-support.patch diff --git a/Spigot-Server-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/Spigot-Server-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch deleted file mode 100644 index 2daa03847..000000000 --- a/Spigot-Server-Patches/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 15 Jun 2013 19:51:17 -0400 -Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API - -Adds ability to get what arrow was shot, and control if it should be consumed. - -diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -@@ -0,0 +0,0 @@ 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(), entityarrow, 0.8F); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), this.getItemInOffHand(), entityarrow, 0.8F); // Paper - if (event.isCancelled()) { - event.getProjectile().remove(); - return; -diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemBow.java -+++ b/src/main/java/net/minecraft/server/ItemBow.java -@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - if ((double) f >= 0.1D) { - boolean flag1 = flag && itemstack1.getItem() == Items.ARROW; - -+ boolean consumeArrow = true; // Paper - if (!world.isClientSide) { - ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW)); - EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman); -@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - entityarrow.setOnFire(100); - } - // CraftBukkit start -- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, f); // Paper - if (event.isCancelled()) { - event.getProjectile().remove(); - return; -@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - itemstack.damage(1, entityhuman, (entityhuman1) -> { - entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand()); - }); -- if (flag1 || entityhuman.abilities.canInstantlyBuild && (itemstack1.getItem() == Items.SPECTRAL_ARROW || itemstack1.getItem() == Items.TIPPED_ARROW)) { -+ consumeArrow = event.getConsumeArrow(); // Paper -+ if (!consumeArrow || flag1 || (entityhuman.abilities.canInstantlyBuild && ((itemstack1.getItem() == Items.SPECTRAL_ARROW) || (itemstack1.getItem() == Items.TIPPED_ARROW)))) { // Paper - add - entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY; - } - -@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { - } - - world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F); -- if (!flag1 && !entityhuman.abilities.canInstantlyBuild) { -+ if (!flag1 && !entityhuman.abilities.canInstantlyBuild && consumeArrow) { // Paper - itemstack1.subtract(1); - if (itemstack1.isEmpty()) { - entityhuman.inventory.f(itemstack1); -diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemCrossbow.java -+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -0,0 +0,0 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable - ((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2); - } - // CraftBukkit start -- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, (Entity) object, f); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (IProjectile) object, f); // Paper // TODO: consume?? - if (event.isCancelled()) { - event.getProjectile().remove(); - return; -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ public class CraftEventFactory { - /** - * EntityShootBowEvent - */ -- public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, Entity entityArrow, float force) { -+ public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, ItemStack arrowItem, IProjectile entityArrow, float force) { // paper - LivingEntity shooter = (LivingEntity) who.getBukkitEntity(); - CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -- org.bukkit.entity.Entity arrow = entityArrow.getBukkitEntity(); -+ org.bukkit.entity.Entity arrow = ((Entity) entityArrow).getBukkitEntity(); // Paper - - if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) { - itemInHand = null; - } - -- EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force); -+ EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, CraftItemStack.asCraftMirror(arrowItem), arrow, force); // Paper - Bukkit.getPluginManager().callEvent(event); - - return event; diff --git a/Spigot-Server-Patches/Fire-EntityShootBowEvent-for-Illusioner.patch b/Spigot-Server-Patches/Fire-EntityShootBowEvent-for-Illusioner.patch deleted file mode 100644 index 6fa50679f..000000000 --- a/Spigot-Server-Patches/Fire-EntityShootBowEvent-for-Illusioner.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 18 Jun 2018 22:19:36 -0400 -Subject: [PATCH] Fire EntityShootBowEvent for Illusioner - - -diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -@@ -0,0 +0,0 @@ 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(), this.getItemInOffHand(), entityarrow,0.8F); -+ 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.c { diff --git a/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch b/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch new file mode 100644 index 000000000..486b122a8 --- /dev/null +++ b/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch @@ -0,0 +1,44 @@ +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/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java ++++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +@@ -0,0 +0,0 @@ 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.c { +diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java ++++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +@@ -0,0 +0,0 @@ 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, EnumHand.MAIN_HAND, 0.8F, true); ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, EnumHand.MAIN_HAND, 0.8F, true); // Paper + if (event.isCancelled()) { + event.getProjectile().remove(); + return; diff --git a/work/Bukkit b/work/Bukkit index 6ff6e0330..565a57274 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 6ff6e0330578458e7e0f869a8b7e7e09a63361e1 +Subproject commit 565a57274a4c8259ffdd9792b70c0a9fe5adb214 diff --git a/work/CraftBukkit b/work/CraftBukkit index 6008e6660..927200a96 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 6008e6660a7be1c06522bc13b52578cb9f1e2dfe +Subproject commit 927200a96161a3cbfb0eaff1ba4474abe608298a