From 167961e7448ce09c8826c803a8d2d698e0984d39 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 16 Jun 2024 09:47:53 -0700 Subject: [PATCH] call EntityDamageItemEvent for thorns --- .../server/0579-Add-EntityDamageItemEvent.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/patches/server/0579-Add-EntityDamageItemEvent.patch b/patches/server/0579-Add-EntityDamageItemEvent.patch index 6026e41afa..d9c3b86a2a 100644 --- a/patches/server/0579-Add-EntityDamageItemEvent.patch +++ b/patches/server/0579-Add-EntityDamageItemEvent.patch @@ -61,3 +61,18 @@ index 7f7445a2b68fd2e6e5fcd509d950a0f8d680c1fe..ebc5f2e8d59da4bec25ff156ec95fe49 // CraftBukkit start - Check for item breaking if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) { org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this); +diff --git a/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java b/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java +index 70796eef426eece0bc93a173f54e90645377b502..82ac989ca836e3beef7c3773db0183a7e51780e0 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java +@@ -16,8 +16,8 @@ public record DamageItem(LevelBasedValue amount) implements EnchantmentEntityEff + + @Override + public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity user, Vec3 pos) { +- ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; +- context.itemStack().hurtAndBreak((int)this.amount.calculate(level), world, serverPlayer2, context.onBreak()); ++ // ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; // Paper - always pass in entity ++ context.itemStack().hurtAndBreak((int)this.amount.calculate(level), world, context.owner(), context.onBreak()); // Paper - always pass in entity + } + + @Override