PaperMC/patches/server/0937-Add-custom-destroyerIdentity-to-sendBlockDamage.patch
Shane Freeder 3996e6ef29
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
c7c11188 SPIGOT-2620: Add Player#sendBlockChanges()
f63d2b44 Improve annotation test on parameters
3372e7b4 SPIGOT-1244, SPIGOT-6860, SPIGOT-6874: Various Javadoc and formatting fixes
a1e8a9ab PR-793: Ignore .checkstyle file generated by Eclipse IDE

CraftBukkit Changes:
c2c39089e SPIGOT-2620: Add Player#sendBlockChanges()
8209158db PR-1113: Ignore .checkstyle file generated by Eclipse IDE

Spigot Changes:
4aa5ead2 Rebuild patches
2022-09-24 02:38:12 +01:00

32 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheFruxz <cedricspitzer@outlook.de>
Date: Sat, 26 Mar 2022 18:41:36 +0100
Subject: [PATCH] Add custom destroyerIdentity to sendBlockDamage
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index feff87fba11ff46ce1ebd0f5fdf5132b85c8eddc..099987645142a5a065b5bd377a16d9d6c59dabd9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1008,13 +1008,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendBlockDamage(Location loc, float progress) {
+ // Paper start - customBlockDamage identity
+ sendBlockDamage(loc, progress, this.getHandle().getId());
+ }
+
+ @Override
+ public void sendBlockDamage(Location loc, float progress, int destroyerIdentity) {
+ // Paper end - customBlockDamage identity
Preconditions.checkArgument(loc != null, "loc must not be null");
Preconditions.checkArgument(progress >= 0.0 && progress <= 1.0, "progress must be between 0.0 and 1.0 (inclusive)");
if (this.getHandle().connection == null) return;
int stage = (int) (9 * progress); // There are 0 - 9 damage states
- ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(this.getHandle().getId(), new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage);
+ ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(destroyerIdentity, new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage); // Paper - customBlockDamage identity
this.getHandle().connection.send(packet);
}