mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 09:58:00 +01:00
call EntityDamageItemEvent for thorns
This commit is contained in:
parent
fbc2a55cde
commit
167961e744
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user