From 38e1465620f2a0e0baf2b6156df72f653be80781 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Wed, 23 Oct 2024 00:02:50 +0200 Subject: [PATCH] Work work work --- .../Add-EntityTeleportEndGatewayEvent.patch | 6 +-- .../Configurable-LootPool-luck-formula.patch | 0 .../server/EndermanAttackPlayerEvent.patch | 14 +++--- ...ld.spawnParticle-API-and-add-Builder.patch | 2 +- .../server/Fix-CraftEntity-hashCode.patch | 0 ...-allowed-colored-signs-to-be-created.patch | 2 +- .../server/Improve-EntityShootBowEvent.patch | 45 ++++++++++++++++++ .../ItemStack-getMaxItemUseDuration.patch | 24 ++-------- ...e-shield-blocking-delay-configurable.patch | 6 +-- ...ils-when-failing-to-save-player-data.patch | 0 ...ed-flag-on-cancel-of-Explosion-Event.patch | 2 +- .../server/WitchConsumePotionEvent.patch | 0 .../server/WitchReadyPotionEvent.patch | 0 patches/server/WitchThrowPotionEvent.patch | 25 ++++++++++ .../server/Improve-EntityShootBowEvent.patch | 47 ------------------- .../server/WitchThrowPotionEvent.patch | 30 ------------ 16 files changed, 88 insertions(+), 115 deletions(-) rename patches/{unapplied => }/server/Add-EntityTeleportEndGatewayEvent.patch (82%) rename patches/{unapplied => }/server/Configurable-LootPool-luck-formula.patch (100%) rename patches/{unapplied => }/server/EndermanAttackPlayerEvent.patch (71%) rename patches/{unapplied => }/server/Expand-World.spawnParticle-API-and-add-Builder.patch (99%) rename patches/{unapplied => }/server/Fix-CraftEntity-hashCode.patch (100%) rename patches/{unapplied => }/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch (98%) create mode 100644 patches/server/Improve-EntityShootBowEvent.patch rename patches/{unapplied => }/server/ItemStack-getMaxItemUseDuration.patch (53%) rename patches/{unapplied => }/server/Make-shield-blocking-delay-configurable.patch (82%) rename patches/{unapplied => }/server/Print-Error-details-when-failing-to-save-player-data.patch (100%) rename patches/{unapplied => }/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch (91%) rename patches/{unapplied => }/server/WitchConsumePotionEvent.patch (100%) rename patches/{unapplied => }/server/WitchReadyPotionEvent.patch (100%) create mode 100644 patches/server/WitchThrowPotionEvent.patch delete mode 100644 patches/unapplied/server/Improve-EntityShootBowEvent.patch delete mode 100644 patches/unapplied/server/WitchThrowPotionEvent.patch diff --git a/patches/unapplied/server/Add-EntityTeleportEndGatewayEvent.patch b/patches/server/Add-EntityTeleportEndGatewayEvent.patch similarity index 82% rename from patches/unapplied/server/Add-EntityTeleportEndGatewayEvent.patch rename to patches/server/Add-EntityTeleportEndGatewayEvent.patch index 845cac5bac..ad34d9ecb6 100644 --- a/patches/unapplied/server/Add-EntityTeleportEndGatewayEvent.patch +++ b/patches/server/Add-EntityTeleportEndGatewayEvent.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - if (!this.isRemoved()) { // CraftBukkit start - Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot()); + PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); + Location to = CraftLocation.toBukkit(absolutePosition.position(), teleportTarget.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot()); - EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to); - if (teleEvent.isCancelled()) { + // Paper start - gateway-specific teleport event @@ -26,4 +26,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (teleEvent.isCancelled() || teleEvent.getTo() == null) { return null; } - to = teleEvent.getTo(); + if (!to.equals(teleEvent.getTo())) { diff --git a/patches/unapplied/server/Configurable-LootPool-luck-formula.patch b/patches/server/Configurable-LootPool-luck-formula.patch similarity index 100% rename from patches/unapplied/server/Configurable-LootPool-luck-formula.patch rename to patches/server/Configurable-LootPool-luck-formula.patch diff --git a/patches/unapplied/server/EndermanAttackPlayerEvent.patch b/patches/server/EndermanAttackPlayerEvent.patch similarity index 71% rename from patches/unapplied/server/EndermanAttackPlayerEvent.patch rename to patches/server/EndermanAttackPlayerEvent.patch index 45cd592499..bdf0d00954 100644 --- a/patches/unapplied/server/EndermanAttackPlayerEvent.patch +++ b/patches/server/EndermanAttackPlayerEvent.patch @@ -12,19 +12,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { - this.readPersistentAngerSaveData(this.level(), nbt); } -- boolean isLookingAtMe(Player player) { + boolean isBeingStaredBy(Player player) { + // Paper start - EndermanAttackPlayerEvent -+ private boolean isLookingAtMe(Player player) { -+ boolean shouldAttack = isLookingAtMe_check(player); ++ boolean shouldAttack = isBeingStaredBy0(player); + com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity()); + event.setCancelled(!shouldAttack); + return event.callEvent(); + } -+ private boolean isLookingAtMe_check(Player player) { -+ // Paper end - EndermanAttackPlayerEvent - ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3); ++ private boolean isBeingStaredBy0(Player player) { ++ // Paper end - EndermanAttackPlayerEvent + return this.isLookingAtMe(player, 0.025D, true, false, LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM, new DoubleSupplier[]{this::getEyeY}); + } - if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) { diff --git a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 99% rename from patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch rename to patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch index 8d58506934..b4466b0ddb 100644 --- a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -13,7 +13,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { diff --git a/patches/unapplied/server/Fix-CraftEntity-hashCode.patch b/patches/server/Fix-CraftEntity-hashCode.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftEntity-hashCode.patch rename to patches/server/Fix-CraftEntity-hashCode.patch diff --git a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch similarity index 98% rename from patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename to patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 27755e6c89..94632315df 100644 --- a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntit index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity { Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle(); if (entityhuman.isTextFilteringEnabled()) { diff --git a/patches/server/Improve-EntityShootBowEvent.patch b/patches/server/Improve-EntityShootBowEvent.patch new file mode 100644 index 0000000000..b26990dfd6 --- /dev/null +++ b/patches/server/Improve-EntityShootBowEvent.patch @@ -0,0 +1,45 @@ +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 skeletons + +== AT == +public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack; + +diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java ++++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo + + if (world instanceof ServerLevel worldserver) { + // CraftBukkit start +- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper - improve entity shhot bow event - add arrow stack to event + if (event.isCancelled()) { + event.getProjectile().remove(); + return; +diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java +@@ -0,0 +0,0 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { + Level world = this.level(); + + if (world instanceof ServerLevel worldserver) { ++ // Paper start - EntityShootBowEvent ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true); ++ if (event.isCancelled()) { ++ event.getProjectile().remove(); ++ return; ++ } ++ ++ if (event.getProjectile() == entityarrow.getBukkitEntity()) { + Projectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4)); ++ } ++ // Paper end - EntityShootBowEvent + } + + this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); diff --git a/patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch b/patches/server/ItemStack-getMaxItemUseDuration.patch similarity index 53% rename from patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch rename to patches/server/ItemStack-getMaxItemUseDuration.patch index 37ed718722..a0f6e96473 100644 --- a/patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch +++ b/patches/server/ItemStack-getMaxItemUseDuration.patch @@ -9,40 +9,22 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -0,0 +0,0 @@ import net.minecraft.core.Holder; - import net.minecraft.core.component.DataComponentPatch; - import net.minecraft.core.component.DataComponents; - import net.minecraft.world.item.Item; -+import net.minecraft.world.item.Items; - import net.minecraft.world.item.enchantment.EnchantmentHelper; - import net.minecraft.world.item.enchantment.ItemEnchantments; - import org.bukkit.Material; - import org.bukkit.configuration.serialization.DelegateDeserialization; - import org.bukkit.craftbukkit.enchantments.CraftEnchantment; -+import org.bukkit.craftbukkit.entity.CraftLivingEntity; - import org.bukkit.craftbukkit.util.CraftLegacy; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; - import org.bukkit.enchantments.Enchantment; -+import org.bukkit.entity.LivingEntity; - import org.bukkit.inventory.ItemStack; - import org.bukkit.inventory.meta.ItemMeta; - import org.bukkit.material.MaterialData; @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize(); } + // Paper start + @Override -+ public int getMaxItemUseDuration(final LivingEntity entity) { ++ public int getMaxItemUseDuration(final org.bukkit.entity.LivingEntity entity) { + if (handle == null) { + return 0; + } + + // Make sure plugins calling the old method don't blow up -+ if (entity == null && handle.is(Items.CROSSBOW)) { ++ if (entity == null && (handle.is(net.minecraft.world.item.Items.CROSSBOW) || handle.is(net.minecraft.world.item.Items.GOAT_HORN))) { + throw new UnsupportedOperationException("This item requires an entity to determine the max use duration"); + } -+ return handle.getUseDuration(entity != null ? ((CraftLivingEntity) entity).getHandle() : null); ++ return handle.getUseDuration(entity != null ? ((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity).getHandle() : null); + } + // Paper end + diff --git a/patches/unapplied/server/Make-shield-blocking-delay-configurable.patch b/patches/server/Make-shield-blocking-delay-configurable.patch similarity index 82% rename from patches/unapplied/server/Make-shield-blocking-delay-configurable.patch rename to patches/server/Make-shield-blocking-delay-configurable.patch index 022c391eda..1e2cf9a9c4 100644 --- a/patches/unapplied/server/Make-shield-blocking-delay-configurable.patch +++ b/patches/server/Make-shield-blocking-delay-configurable.patch @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); -- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= 5; -+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable +- return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < 5 ? null : this.useItem); ++ return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < getShieldBlockingDelay() ? null : this.useItem); // Paper - Make shield blocking delay configurable } else { - return false; + return null; } } diff --git a/patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/Print-Error-details-when-failing-to-save-player-data.patch similarity index 100% rename from patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch rename to patches/server/Print-Error-details-when-failing-to-save-player-data.patch diff --git a/patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 91% rename from patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index dd01def422..428ad092d8 100644 --- a/patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -@@ -0,0 +0,0 @@ public class Creeper extends Monster implements PowerableMob { +@@ -0,0 +0,0 @@ public class Creeper extends Monster { // CraftBukkit start } else { this.swell = 0; diff --git a/patches/unapplied/server/WitchConsumePotionEvent.patch b/patches/server/WitchConsumePotionEvent.patch similarity index 100% rename from patches/unapplied/server/WitchConsumePotionEvent.patch rename to patches/server/WitchConsumePotionEvent.patch diff --git a/patches/unapplied/server/WitchReadyPotionEvent.patch b/patches/server/WitchReadyPotionEvent.patch similarity index 100% rename from patches/unapplied/server/WitchReadyPotionEvent.patch rename to patches/server/WitchReadyPotionEvent.patch diff --git a/patches/server/WitchThrowPotionEvent.patch b/patches/server/WitchThrowPotionEvent.patch new file mode 100644 index 0000000000..f4152dc198 --- /dev/null +++ b/patches/server/WitchThrowPotionEvent.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 16 May 2018 20:44:58 -0400 +Subject: [PATCH] WitchThrowPotionEvent + +Fired when a witch throws a potion at a player + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java +@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { + ServerLevel worldserver = (ServerLevel) world; + ItemStack itemstack = PotionContents.createItemStack(Items.SPLASH_POTION, holder); + ++ // Paper start - WitchThrowPotionEvent ++ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); ++ if (!event.callEvent()) { ++ return; ++ } ++ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion()); ++ // Paper end - WitchThrowPotionEvent + Projectile.spawnProjectileUsingShoot(ThrownPotion::new, worldserver, itemstack, this, d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F); + } + diff --git a/patches/unapplied/server/Improve-EntityShootBowEvent.patch b/patches/unapplied/server/Improve-EntityShootBowEvent.patch deleted file mode 100644 index b95bbba2a0..0000000000 --- a/patches/unapplied/server/Improve-EntityShootBowEvent.patch +++ /dev/null @@ -1,47 +0,0 @@ -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 skeletons - -== AT == -public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack; - -diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo - - entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); - // CraftBukkit start -- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper - if (event.isCancelled()) { - event.getProjectile().remove(); - return; -diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java -@@ -0,0 +0,0 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { - double d3 = Math.sqrt(d0 * d0 + d2 * d2); - - entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); -+ // Paper start - EntityShootBowEvent -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true); -+ if (event.isCancelled()) { -+ event.getProjectile().remove(); -+ return; -+ } -+ -+ if (event.getProjectile() == entityarrow.getBukkitEntity()) { -+ this.level().addFreshEntity(entityarrow); -+ } -+ // Paper end - EntityShootBowEvent - this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); -- this.level().addFreshEntity(entityarrow); - } - - @Override diff --git a/patches/unapplied/server/WitchThrowPotionEvent.patch b/patches/unapplied/server/WitchThrowPotionEvent.patch deleted file mode 100644 index 7333fb1e0b..0000000000 --- a/patches/unapplied/server/WitchThrowPotionEvent.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 16 May 2018 20:44:58 -0400 -Subject: [PATCH] WitchThrowPotionEvent - -Fired when a witch throws a potion at a player - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Witch.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java -@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { - holder = Potions.WEAKNESS; - } - -+ // Paper start - WitchThrowPotionEvent -+ ItemStack potion = PotionContents.createItemStack(Items.SPLASH_POTION, holder); -+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); -+ if (!event.callEvent()) { -+ return; -+ } -+ potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion()); - ThrownPotion entitypotion = new ThrownPotion(this.level(), this); -- -- entitypotion.setItem(PotionContents.createItemStack(Items.SPLASH_POTION, holder)); -+ entitypotion.setItem(potion); -+ // Paper end - WitchThrowPotionEvent - entitypotion.setXRot(entitypotion.getXRot() - -20.0F); - entitypotion.shoot(d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F); - if (!this.isSilent()) {