diff options
author | Jake Potrebic <[email protected]> | 2024-06-16 09:47:53 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-06-16 09:47:53 -0700 |
commit | 167961e7448ce09c8826c803a8d2d698e0984d39 (patch) | |
tree | cc8835298d22a260b5a1744799425ef2a0324c44 | |
parent | fbc2a55cde3ff9c06f859e7f04544b37e01dbd28 (diff) | |
download | Paper-167961e7448ce09c8826c803a8d2d698e0984d39.tar.gz Paper-167961e7448ce09c8826c803a8d2d698e0984d39.zip |
call EntityDamageItemEvent for thorns
-rw-r--r-- | patches/server/0579-Add-EntityDamageItemEvent.patch | 15 |
1 files changed, 15 insertions, 0 deletions
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 |