13
0
geforkt von Mirrors/Paper

call EntityDamageItemEvent for thorns

Dieser Commit ist enthalten in:
Jake Potrebic 2024-06-16 09:47:53 -07:00
Ursprung 07e821664d
Commit bff551166c

Datei anzeigen

@ -61,3 +61,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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