3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

don't return for neg damage

Dieser Commit ist enthalten in:
Tamion 2024-11-02 14:58:21 +01:00
Ursprung 0ec01a007a
Commit 0f545db9ea
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 01E616386DBAE296
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index f00b756fe5dad616323e3b11e35e27353f347042..88700393292c0a036c168428cd32e2f3ba07feb9 100644 index f00b756fe5dad616323e3b11e35e27353f347042..55fb8f14f85efd589cc43c772dcb926646609691 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -692,11 +692,15 @@ public final class ItemStack implements DataComponentHolder { @@ -692,11 +692,15 @@ public final class ItemStack implements DataComponentHolder {
@ -19,7 +19,7 @@ index f00b756fe5dad616323e3b11e35e27353f347042..88700393292c0a036c168428cd32e2f3
- if (player != null) { - if (player != null) {
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j); - PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j);
+ // Paper start - Add EntityDamageItemEvent + // Paper start - Add EntityDamageItemEvent
+ if (j <= 0) { + if (j == 0) {
+ return; + return;
+ } else if (player instanceof final ServerPlayer serverPlayer) { + } else if (player instanceof final ServerPlayer serverPlayer) {
+ // Paper end - Add EntityDamageItemEvent + // Paper end - Add EntityDamageItemEvent
@ -43,7 +43,7 @@ index f00b756fe5dad616323e3b11e35e27353f347042..88700393292c0a036c168428cd32e2f3
// CraftBukkit end // CraftBukkit end
- if (j != 0) { - if (j != 0) {
+ if (j > 0) { // Paper - Add EntityDamageItemEvent + if (j != 0) { // Paper - Add EntityDamageItemEvent
this.applyDamage(this.getDamageValue() + j, player, breakCallback); this.applyDamage(this.getDamageValue() + j, player, breakCallback);
} }

Datei anzeigen

@ -11,7 +11,7 @@ the logic associated with damaging them
public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 2b0e8a159cf0765c6c93928384cd2ca2eb211e2a..6f2f3148823615f234f93b3b08722743dcfc7506 100644 index 13a7c23a7bee6be0ac14ba69b80dc54e5c18de93..a1c8e3ec97394880d9abe789d0025d0c6d21ad95 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -693,8 +693,13 @@ public final class ItemStack implements DataComponentHolder { @@ -693,8 +693,13 @@ public final class ItemStack implements DataComponentHolder {
@ -28,7 +28,7 @@ index 2b0e8a159cf0765c6c93928384cd2ca2eb211e2a..6f2f3148823615f234f93b3b08722743
+ int j = this.processDurabilityChange(amount, world, player, force); // Paper + int j = this.processDurabilityChange(amount, world, player, force); // Paper
// CraftBukkit start // CraftBukkit start
// Paper start - Add EntityDamageItemEvent // Paper start - Add EntityDamageItemEvent
if (j <= 0) { if (j == 0) {
@@ -730,7 +735,12 @@ public final class ItemStack implements DataComponentHolder { @@ -730,7 +735,12 @@ public final class ItemStack implements DataComponentHolder {
} }