diff options
author | Bjarne Koll <[email protected]> | 2024-10-31 12:44:02 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-31 12:44:02 +0100 |
commit | dfedf79a2fecd80cafabcd82bb2e6dd80e558fc3 (patch) | |
tree | 5986a5b10f31ce04b6625b9e53f7e776faabbb09 | |
parent | 40a960db45f45f381328a60695e933615475aea8 (diff) | |
download | Paper-dfedf79a2fecd80cafabcd82bb2e6dd80e558fc3.tar.gz Paper-dfedf79a2fecd80cafabcd82bb2e6dd80e558fc3.zip |
Correctly cancel consumption of consumable
See: #11534
30 files changed, 125 insertions, 49 deletions
diff --git a/patches/server/0503-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0503-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index 85bf38a0c7..fddb117aea 100644 --- a/patches/server/0503-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0503-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,14 +9,14 @@ till their item is switched. This patch clears the active item when the event is cancelled diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ce9369e730ba8862cd1e6e26f8825c35b16fcfb9..9d56e7d4185401767359907337d5891ff0058abb 100644 +index ce9369e730ba8862cd1e6e26f8825c35b16fcfb9..502a5455533113ef580cd23399dc1dcad530b0ae 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -4134,6 +4134,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.level().getCraftServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { +@@ -4141,6 +4141,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + entityPlayer.getBukkitEntity().updateInventory(); + entityPlayer.getBukkitEntity().updateScaledHealth(); + this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use - // Update client - Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); - if (consumable != null) { + return; + } + diff --git a/patches/server/0548-Line-Of-Sight-Changes.patch b/patches/server/0548-Line-Of-Sight-Changes.patch index 0b72d78709..9675120b2a 100644 --- a/patches/server/0548-Line-Of-Sight-Changes.patch +++ b/patches/server/0548-Line-Of-Sight-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9d56e7d4185401767359907337d5891ff0058abb..8939ce9fed5d935cec31c9a27833d1cec4de7b01 100644 +index 502a5455533113ef580cd23399dc1dcad530b0ae..83557da78340e3327f8c9a3050662413ecc3fc17 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3905,7 +3905,8 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0593-Improve-and-expand-AsyncCatcher.patch b/patches/server/0593-Improve-and-expand-AsyncCatcher.patch index 0e27a17c00..6460d2f056 100644 --- a/patches/server/0593-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0593-Improve-and-expand-AsyncCatcher.patch @@ -29,7 +29,7 @@ index 70b891bd018029eda8cda4fb9f919e77524dbc5e..a4abcbc69ccd023a936d02d359ba4c08 if (player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8939ce9fed5d935cec31c9a27833d1cec4de7b01..564024738cc346abc024967c2d55f2553af3e660 100644 +index 83557da78340e3327f8c9a3050662413ecc3fc17..4f13d792a2cc504f174766d4c0d924d9ca51df9c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1143,7 +1143,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch index d7f8266ad6..d138c932cb 100644 --- a/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0622-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 564024738cc346abc024967c2d55f2553af3e660..8e0805bf6d330717f7555fbdb28d416295f8495a 100644 +index 4f13d792a2cc504f174766d4c0d924d9ca51df9c..2ae65d0303a01536bae6ef8f900b23b94d72dc22 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2863,17 +2863,29 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0650-Freeze-Tick-Lock-API.patch b/patches/server/0650-Freeze-Tick-Lock-API.patch index 98811e5645..db82c2c3bc 100644 --- a/patches/server/0650-Freeze-Tick-Lock-API.patch +++ b/patches/server/0650-Freeze-Tick-Lock-API.patch @@ -46,7 +46,7 @@ index 06d7aed2539a0f38fabe5b10c91d8da10c43605f..4b0b768a4563281ec4ef1a16a3a21c24 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8e0805bf6d330717f7555fbdb28d416295f8495a..8b454382f59ee36ec6f45ca8445b3f1a956ff668 100644 +index 2ae65d0303a01536bae6ef8f900b23b94d72dc22..f0a3a1342610966f954d8f25fd38281b2af80f06 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3609,7 +3609,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0693-Add-PlayerStopUsingItemEvent.patch b/patches/server/0693-Add-PlayerStopUsingItemEvent.patch index 2e1c8f29d0..cbf893f693 100644 --- a/patches/server/0693-Add-PlayerStopUsingItemEvent.patch +++ b/patches/server/0693-Add-PlayerStopUsingItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8b454382f59ee36ec6f45ca8445b3f1a956ff668..786ac2127bc743cf2a33776314a4b5c197f35538 100644 +index f0a3a1342610966f954d8f25fd38281b2af80f06..94cc2bc2f5e6ed32173f675c3b27ab602dbcd7f8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4202,6 +4202,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch b/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch index 2c6afde2fa..0b36d67e7b 100644 --- a/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch +++ b/patches/server/0728-Stop-large-look-changes-from-crashing-the-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Stop large look changes from crashing the server Co-authored-by: Jaren Knodel <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 786ac2127bc743cf2a33776314a4b5c197f35538..b367f6e329f44801c6f0d34f447497093d86ae3b 100644 +index 94cc2bc2f5e6ed32173f675c3b27ab602dbcd7f8..079e6224c56128c0a0fc0643eeec49f2475937ea 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3270,37 +3270,15 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0760-check-global-player-list-where-appropriate.patch b/patches/server/0760-check-global-player-list-where-appropriate.patch index 393c169165..96d945ad74 100644 --- a/patches/server/0760-check-global-player-list-where-appropriate.patch +++ b/patches/server/0760-check-global-player-list-where-appropriate.patch @@ -24,7 +24,7 @@ index 45e61a08152517a61260e662764d8bb0335537e3..b81d814619e4175f42aee397811b07ca + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b367f6e329f44801c6f0d34f447497093d86ae3b..5330f6315cecfa6afd04b711a5b8656717cb5ede 100644 +index 079e6224c56128c0a0fc0643eeec49f2475937ea..0e2b5e1dbdf671da0a4edfa77f7fb759732674cb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3865,7 +3865,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0763-Friction-API.patch b/patches/server/0763-Friction-API.patch index 8a1f012053..0262ffef84 100644 --- a/patches/server/0763-Friction-API.patch +++ b/patches/server/0763-Friction-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Friction API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5330f6315cecfa6afd04b711a5b8656717cb5ede..8b0a764984f886b711cb337a7f70608167916bf3 100644 +index 0e2b5e1dbdf671da0a4edfa77f7fb759732674cb..076c7828fdfa53c7453406beb937700e12b137d2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -296,6 +296,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch index b778104720..427a668981 100644 --- a/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch +++ b/patches/server/0782-Correctly-shrink-items-during-EntityResurrectEvent.patch @@ -22,7 +22,7 @@ This patch corrects this behaviour by only shrinking the item if a totem of undying was found and the event was called uncancelled. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8b0a764984f886b711cb337a7f70608167916bf3..9ef5c617cb05f08758105772b9124f6c318b5c17 100644 +index 076c7828fdfa53c7453406beb937700e12b137d2..879ac6ec0b429ddb89ede2d51c8ccee9090fdc49 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1672,7 +1672,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch b/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch index c7075265f1..7a76ace176 100644 --- a/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/0792-Fix-advancement-triggers-for-entity-damage.patch @@ -23,7 +23,7 @@ index 821bb93e1b055ba38fafe3b7079d79aa062ebe8a..221d73676fe2fd240a47cf312c1179e0 return !this.getResponse(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9ef5c617cb05f08758105772b9124f6c318b5c17..24245cfb160dc990b3661388c2f95b9383f98428 100644 +index 879ac6ec0b429ddb89ede2d51c8ccee9090fdc49..2a587683463fb0a0770ab54125868e82c0694ca6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2463,7 +2463,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch index 1fb19203b6..3c153487e4 100644 --- a/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch +++ b/patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Broadcast take item packets with collector as source This fixes players (which can't view the collector) seeing item pickups with themselves as the target. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 24245cfb160dc990b3661388c2f95b9383f98428..09bd6ba5907d42bed08872f18d40d8c743d392ff 100644 +index 2a587683463fb0a0770ab54125868e82c0694ca6..375280dd829eb2f6b98a95228250a3d87a7872cf 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3891,7 +3891,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch b/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch index 24339297b7..6a0d1b6e72 100644 --- a/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch +++ b/patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch @@ -68,7 +68,7 @@ index 64dc0bd1900575e40ac72a98c6df371223bd244c..c2693d530be00af16b2aa4ca4afd1d13 }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 09bd6ba5907d42bed08872f18d40d8c743d392ff..251abe382f951c3ddac8112a0ffe1dc906b88e4c 100644 +index 375280dd829eb2f6b98a95228250a3d87a7872cf..e8749957c39abcd922b734a87df95b815012737a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1159,6 +1159,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch index d6f9795558..8ad8d898eb 100644 --- a/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0902-Restore-vanilla-entity-drops-behavior.patch @@ -89,7 +89,7 @@ index 5c7df0efee4a0aa078e36d3e262cd0b48a27cf47..b78395ab8f393a0f6551951731ddce7a return this.spawnAtLocation(world, entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 251abe382f951c3ddac8112a0ffe1dc906b88e4c..adde7352cdbcb8684f43d6bf5978b6943e9f165b 100644 +index e8749957c39abcd922b734a87df95b815012737a..9e105732fb765258af9154b84534234fd84eb24f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -289,7 +289,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch b/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch index dc1f06ed56..636531b7e9 100644 --- a/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch +++ b/patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch @@ -26,7 +26,7 @@ index c6dcc37ac5fcf50bcb246f533b99983dfc5c19c2..c13b6f14c3061710c2b27034db240cc9 d3 = to.getX(); d4 = to.getY(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index adde7352cdbcb8684f43d6bf5978b6943e9f165b..9d3d6f012cfca60884019ed9710804aa37b11fbf 100644 +index 9e105732fb765258af9154b84534234fd84eb24f..97a524db692b7367f22a373439c1233b143f4a17 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4363,7 +4363,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch index a7e42195f1..5374ae13cb 100644 --- a/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch @@ -85,7 +85,7 @@ index b7721ed97305d1cd6725935f965c2effc1bef5a1..5f880a8809f9c20bc8e8c0b2d48590ba if (nbt.contains("leash", 11)) { Either<UUID, BlockPos> either = (Either) NbtUtils.readBlockPos(nbt, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9d3d6f012cfca60884019ed9710804aa37b11fbf..49b3d8d2bc34c0785f143bbc8976308f5bf8c9de 100644 +index 97a524db692b7367f22a373439c1233b143f4a17..2fa73a9f444628a5e0df9f54e9bcd453973f0029 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -909,11 +909,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0945-Fix-shield-disable-inconsistency.patch b/patches/server/0945-Fix-shield-disable-inconsistency.patch index 0f02785268..30eef15e53 100644 --- a/patches/server/0945-Fix-shield-disable-inconsistency.patch +++ b/patches/server/0945-Fix-shield-disable-inconsistency.patch @@ -8,7 +8,7 @@ it will not disable the shield if the attacker is holding an axe item. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 49b3d8d2bc34c0785f143bbc8976308f5bf8c9de..f6d55ff3027bb7f0dcef186c52d48d9c5358ffd0 100644 +index 2fa73a9f444628a5e0df9f54e9bcd453973f0029..e2a069d15d355e985bd80e27023c53b8ef72e0e9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2424,7 +2424,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch b/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch index 035254da67..3c84264fc6 100644 --- a/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch +++ b/patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Revert to vanilla handling of LivingEntity#actuallyHurt diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f6d55ff3027bb7f0dcef186c52d48d9c5358ffd0..563e008740bf2017a1767470a2e34629dfa5cfa1 100644 +index e2a069d15d355e985bd80e27023c53b8ef72e0e9..ea423fd53150b4a530de673359bfcadc432e9501 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1455,7 +1455,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch index ec6969e742..5ac9189c3e 100644 --- a/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -222,7 +222,7 @@ index af3e0049beb5590520ed84b52d6df85ad22a8f23..b7ff8607cd33d8e6bdab9533792cf43a ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - fix slot desync - always refresh player inventory diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 563e008740bf2017a1767470a2e34629dfa5cfa1..51c3ab2baae8cbd246464777b8ddbde2d3d9d0ef 100644 +index ea423fd53150b4a530de673359bfcadc432e9501..ce686e5a98aea61979b842637ed6ebb97e64d2e1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3460,7 +3460,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch b/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch index 95d97e81fa..63023e73f0 100644 --- a/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch +++ b/patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable damage tick when blocking with shield diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 51c3ab2baae8cbd246464777b8ddbde2d3d9d0ef..afa33711426ee28f70be216497941a10de3416ee 100644 +index ce686e5a98aea61979b842637ed6ebb97e64d2e1..cebb05310502cd1e2277896e75fddab268a3fdf1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2486,7 +2486,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0990-Check-distance-in-entity-interactions.patch b/patches/server/0990-Check-distance-in-entity-interactions.patch index 238e3e4518..bfc89098b0 100644 --- a/patches/server/0990-Check-distance-in-entity-interactions.patch +++ b/patches/server/0990-Check-distance-in-entity-interactions.patch @@ -17,7 +17,7 @@ index 57223285860f61119b6cf348aa78e59384a04e22..ccfe9ef24dce9f34613692adb13738d3 }; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index afa33711426ee28f70be216497941a10de3416ee..22f520414442c05986cc620208afaa895d8ee4fa 100644 +index cebb05310502cd1e2277896e75fddab268a3fdf1..40697022b64100fcf7f5c079c6863cd0eabfb0b8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1467,7 +1467,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0992-Properly-resend-entities.patch b/patches/server/0992-Properly-resend-entities.patch index 4fe85b0191..44ebe1b5b5 100644 --- a/patches/server/0992-Properly-resend-entities.patch +++ b/patches/server/0992-Properly-resend-entities.patch @@ -102,7 +102,7 @@ index 52eafd99ed63f5fc9596225cf45175b1287f20a1..e5db85f858ab376b225172e22b92b841 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 751fc4b0fe60c6d26ea0f768f3d66031a4bad963..f6eed6cb2bd69c15aa36a8d8d9abdfda6d4a0622 100644 +index 751fc4b0fe60c6d26ea0f768f3d66031a4bad963..700ab5ef2f8ab1466c4f659cd34679dc809efbaf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -396,7 +396,7 @@ public abstract class PlayerList { @@ -114,6 +114,25 @@ index 751fc4b0fe60c6d26ea0f768f3d66031a4bad963..f6eed6cb2bd69c15aa36a8d8d9abdfda this.sendLevelInfo(player, worldserver1); +@@ -907,12 +907,17 @@ public abstract class PlayerList { + } + + public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl networkHandler) { ++ // Paper start - collect packets ++ this.sendActiveEffects(entity, networkHandler::send); ++ } ++ public void sendActiveEffects(LivingEntity entity, java.util.function.Consumer<Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> packetConsumer) { ++ // Paper end - collect packets + Iterator iterator = entity.getActiveEffects().iterator(); + + while (iterator.hasNext()) { + MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); + +- networkHandler.send(new ClientboundUpdateMobEffectPacket(entity.getId(), mobeffect, false)); ++ packetConsumer.accept(new ClientboundUpdateMobEffectPacket(entity.getId(), mobeffect, false)); // Paper - collect packets + } + + } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 7fbaaed892b39ca920b15e08d6c44943a69a35d7..ddfc4818f091802e5999c6b99e5bc57c6f370648 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java @@ -167,7 +186,7 @@ index 7fbaaed892b39ca920b15e08d6c44943a69a35d7..ddfc4818f091802e5999c6b99e5bc57c public boolean equals(Object object) { return object instanceof Entity ? ((Entity) object).id == this.id : false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 22f520414442c05986cc620208afaa895d8ee4fa..d19a9aa8f73b3a07e7d3d63efa5d411add163fa4 100644 +index 40697022b64100fcf7f5c079c6863cd0eabfb0b8..61d4515cce2b5ed73a2202d43b8f96bb63b9a459 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4029,6 +4029,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -182,15 +201,6 @@ index 22f520414442c05986cc620208afaa895d8ee4fa..d19a9aa8f73b3a07e7d3d63efa5d411a private void updatingUsingItem() { if (this.isUsingItem()) { if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { -@@ -4164,7 +4169,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use - // Update client - Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); -- if (consumable != null) { -+ if (false && consumable != null) { // Paper - consumable.cancelUsingItem(entityPlayer, this.useItem); - } - entityPlayer.getBukkitEntity().updateInventory(); diff --git a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java index 5a12f4c1de2d020e84af933d491397b38d227824..4eca5996a867086be22d22d99db81ab001467516 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java @@ -205,6 +215,72 @@ index 5a12f4c1de2d020e84af933d491397b38d227824..4eca5996a867086be22d22d99db81ab0 return Optional.of(InteractionResult.FAIL); } entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); +diff --git a/src/main/java/net/minecraft/world/item/component/Consumable.java b/src/main/java/net/minecraft/world/item/component/Consumable.java +index fe8618451e3a3f5185704f791723f7897870b6f2..6be5e7b0ce975702ae7c337a06faa59ff3414d64 100644 +--- a/src/main/java/net/minecraft/world/item/component/Consumable.java ++++ b/src/main/java/net/minecraft/world/item/component/Consumable.java +@@ -97,10 +97,12 @@ public record Consumable(float consumeSeconds, ItemUseAnimation animation, Holde + + // CraftBukkit start + public void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack) { ++ final java.util.List<net.minecraft.network.protocol.Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> packets = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); // Paper - properly resend entities - collect packets for bundle + itemstack.getAllOfType(ConsumableListener.class).forEach((consumablelistener) -> { +- consumablelistener.cancelUsingItem(entityplayer, itemstack); ++ consumablelistener.cancelUsingItem(entityplayer, itemstack, packets); // Paper - properly resend entities - collect packets for bundle + }); +- entityplayer.server.getPlayerList().sendActivePlayerEffects(entityplayer); ++ entityplayer.server.getPlayerList().sendActiveEffects(entityplayer, packets::add); // Paper - properly resend entities - collect packets for bundle ++ entityplayer.connection.send(new net.minecraft.network.protocol.game.ClientboundBundlePacket(packets)); + } + // CraftBukkit end + +diff --git a/src/main/java/net/minecraft/world/item/component/ConsumableListener.java b/src/main/java/net/minecraft/world/item/component/ConsumableListener.java +index 03ff8a5aa5083d87d77b68371557cf4e97003114..c66475c7e20b5752dcc9263e44f541f9f2b8e6de 100644 +--- a/src/main/java/net/minecraft/world/item/component/ConsumableListener.java ++++ b/src/main/java/net/minecraft/world/item/component/ConsumableListener.java +@@ -8,5 +8,5 @@ public interface ConsumableListener { + + void onConsume(Level world, LivingEntity user, ItemStack stack, Consumable consumable); + +- default void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack) {} // CraftBukkit ++ default void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack, java.util.List<net.minecraft.network.protocol.Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> collectedPackets) {} // CraftBukkit // Paper - properly resend entities - collect packets for bundle + } +diff --git a/src/main/java/net/minecraft/world/item/component/OminousBottleAmplifier.java b/src/main/java/net/minecraft/world/item/component/OminousBottleAmplifier.java +index 202d3c4741f3f6468a09bfd8e661b9823a332ea7..6b5723b817e48a4c231014f28e45b20754c2c090 100644 +--- a/src/main/java/net/minecraft/world/item/component/OminousBottleAmplifier.java ++++ b/src/main/java/net/minecraft/world/item/component/OminousBottleAmplifier.java +@@ -28,8 +28,14 @@ public record OminousBottleAmplifier(int value) implements ConsumableListener, T + + @Override + public void onConsume(Level world, LivingEntity user, ItemStack stack, Consumable consumable) { +- user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); ++ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below + } ++ // Paper start - properly resend entities - collect packets for bundle ++ @Override ++ public void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack, java.util.List<net.minecraft.network.protocol.Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> collectedPackets) { ++ collectedPackets.add(new net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket(entityplayer.getId(), MobEffects.BAD_OMEN)); ++ } ++ // Paper end - properly resend entities - collect packets for bundle + + @Override + public void addToTooltip(Item.TooltipContext context, Consumer<Component> tooltip, TooltipFlag type) { +diff --git a/src/main/java/net/minecraft/world/item/component/SuspiciousStewEffects.java b/src/main/java/net/minecraft/world/item/component/SuspiciousStewEffects.java +index 04760d8ba7c560bd9d11191c666715ae8c3e4bff..021169d709964b1bb65e49bf3fcf3119f0749448 100644 +--- a/src/main/java/net/minecraft/world/item/component/SuspiciousStewEffects.java ++++ b/src/main/java/net/minecraft/world/item/component/SuspiciousStewEffects.java +@@ -46,9 +46,9 @@ public record SuspiciousStewEffects(List<SuspiciousStewEffects.Entry> effects) i + + // CraftBukkit start + @Override +- public void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack) { ++ public void cancelUsingItem(net.minecraft.server.level.ServerPlayer entityplayer, ItemStack itemstack, java.util.List<net.minecraft.network.protocol.Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> collectedPackets) { // Paper - properly resend entities - collect packets for bundle + for (SuspiciousStewEffects.Entry suspicioussteweffects_a : this.effects) { +- entityplayer.connection.send(new net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket(entityplayer.getId(), suspicioussteweffects_a.effect())); ++ collectedPackets.add(new net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket(entityplayer.getId(), suspicioussteweffects_a.effect())); // Paper - bundlize packets + } + } + // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 7536ab5c22d97a074c08a95fff6bc756d61e387d..b0e49ad831f1ebc6b126bf82c5fddaebffb91312 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch b/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch index 4dfe84dde1..df30fe3fdd 100644 --- a/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch +++ b/patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch @@ -12,7 +12,7 @@ This patch moves the invocation directly before the #actuallyHurt calls, respective invulnerable timings. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d19a9aa8f73b3a07e7d3d63efa5d411add163fa4..14420fb1ab7f77ef649a86d4fb58e747e4bab0cd 100644 +index 61d4515cce2b5ed73a2202d43b8f96bb63b9a459..2edb4a4a7638f7bea2d50fa3ce8a5d9916c90a26 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1489,12 +1489,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1019-Check-dead-flag-in-isAlive.patch b/patches/server/1019-Check-dead-flag-in-isAlive.patch index b4ac221ddf..c2653e4474 100644 --- a/patches/server/1019-Check-dead-flag-in-isAlive.patch +++ b/patches/server/1019-Check-dead-flag-in-isAlive.patch @@ -15,7 +15,7 @@ Also, even if the plugin is responsibly checking !isDead() before modifying heal I am currently unable to replicate, these "revived" entities can still appear diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 14420fb1ab7f77ef649a86d4fb58e747e4bab0cd..3cc0b820363e748bca7f8770239b38f3845dd6a6 100644 +index 2edb4a4a7638f7bea2d50fa3ce8a5d9916c90a26..4d75ce205d5a0d61780936aa522710f5f753b271 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2145,7 +2145,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1032-Void-damage-configuration-API.patch b/patches/server/1032-Void-damage-configuration-API.patch index e570f4305a..f295b3373b 100644 --- a/patches/server/1032-Void-damage-configuration-API.patch +++ b/patches/server/1032-Void-damage-configuration-API.patch @@ -20,7 +20,7 @@ index ddfc4818f091802e5999c6b99e5bc57c6f370648..e5466be840ef32e4fa17c0e9446c4d0b && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { // Paper end - Configurable nether ceiling damage diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3cc0b820363e748bca7f8770239b38f3845dd6a6..a7a2306433014f45e2a448ebe125b668cc49b3d1 100644 +index 4d75ce205d5a0d61780936aa522710f5f753b271..22bb0aaf3aebdc60a8894dc473cbeb0e58ca37b8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2700,7 +2700,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1038-Moonrise-optimisation-patches.patch b/patches/server/1038-Moonrise-optimisation-patches.patch index 6faf764e05..c40f783855 100644 --- a/patches/server/1038-Moonrise-optimisation-patches.patch +++ b/patches/server/1038-Moonrise-optimisation-patches.patch @@ -28026,10 +28026,10 @@ index b7d29389a357f142237cecd75f8ca91cf1eb6b5b..e4b0dc3121101d54394a0c3a413dabf8 this.generatingStep = generationStep; this.cache = chunks; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f6eed6cb2bd69c15aa36a8d8d9abdfda6d4a0622..1ada5a98169027cbb04f6bc37c96245c17d44c1e 100644 +index 700ab5ef2f8ab1466c4f659cd34679dc809efbaf..b28b23c69512b054e856388f2f94d27d35347b8c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1415,7 +1415,7 @@ public abstract class PlayerList { +@@ -1420,7 +1420,7 @@ public abstract class PlayerList { public void setViewDistance(int viewDistance) { this.viewDistance = viewDistance; diff --git a/patches/server/1042-Improved-Watchdog-Support.patch b/patches/server/1042-Improved-Watchdog-Support.patch index 77dc664f28..d19dc9a173 100644 --- a/patches/server/1042-Improved-Watchdog-Support.patch +++ b/patches/server/1042-Improved-Watchdog-Support.patch @@ -302,7 +302,7 @@ index bf2bae3166df06be240dbbeecce16a24c85897a9..c06863578c5d654706d93e73059d89c1 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 1ada5a98169027cbb04f6bc37c96245c17d44c1e..9c474f3e603c6c274610e15f184468dc640b5eb0 100644 +index b28b23c69512b054e856388f2f94d27d35347b8c..88f40e54fa3b78d82261e06f941ef42587d52c25 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -553,7 +553,7 @@ public abstract class PlayerList { diff --git a/patches/server/1048-Incremental-chunk-and-player-saving.patch b/patches/server/1048-Incremental-chunk-and-player-saving.patch index 239e73fd15..9494da1fd0 100644 --- a/patches/server/1048-Incremental-chunk-and-player-saving.patch +++ b/patches/server/1048-Incremental-chunk-and-player-saving.patch @@ -97,7 +97,7 @@ index 8ceeebb561046933cba0725e15732fa074226884..8c9148426f23cbbdfaf7ae66657d1a62 private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9c474f3e603c6c274610e15f184468dc640b5eb0..0856313f8da044bf021bf04f5ef67a17f4a9f7c6 100644 +index 88f40e54fa3b78d82261e06f941ef42587d52c25..cf42042c754b30e41c0ec8a6a15195369bdbd199 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -518,6 +518,7 @@ public abstract class PlayerList { @@ -108,7 +108,7 @@ index 9c474f3e603c6c274610e15f184468dc640b5eb0..0856313f8da044bf021bf04f5ef67a17 this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1147,9 +1148,21 @@ public abstract class PlayerList { +@@ -1152,9 +1153,21 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/patches/server/1051-Lag-compensation-ticks.patch b/patches/server/1051-Lag-compensation-ticks.patch index 61cc0cc048..10fb304c18 100644 --- a/patches/server/1051-Lag-compensation-ticks.patch +++ b/patches/server/1051-Lag-compensation-ticks.patch @@ -63,7 +63,7 @@ index 504c996220b278c194c93e001a3b326d549868ec..a96f859a5d0c6ec692d4627a69f3c9ee if (this.hasDelayedDestroy) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a7a2306433014f45e2a448ebe125b668cc49b3d1..e3b81e5b2591fde8e15dfd0bee393000dd633096 100644 +index 22bb0aaf3aebdc60a8894dc473cbeb0e58ca37b8..9c61225a728a2ca91a1c71dead75fc7cd93668b6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4050,6 +4050,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1056-Allow-using-old-ender-pearl-behavior.patch b/patches/server/1056-Allow-using-old-ender-pearl-behavior.patch index 554c760b1a..116240194a 100644 --- a/patches/server/1056-Allow-using-old-ender-pearl-behavior.patch +++ b/patches/server/1056-Allow-using-old-ender-pearl-behavior.patch @@ -30,7 +30,7 @@ index 4e4e5b7e8c387cf13cf5bc5e39d334c3222c9103..cffbd3300967e5d80b5973b35a76235b } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0856313f8da044bf021bf04f5ef67a17f4a9f7c6..6b885e55334f3d5c469e889f070e95d94ae782d3 100644 +index cf42042c754b30e41c0ec8a6a15195369bdbd199..1fcd9cd9344b0d2c4752042b07142db7d727dce8 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -602,7 +602,13 @@ public abstract class PlayerList { |