Skip to content

Commit 6ea4202

Browse files
authored
Send all attributes on respawn (#12274)
1 parent 310f522 commit 6ea4202

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

paper-server/patches/features/0016-Moonrise-optimisation-patches.patch

+6-6
Original file line numberDiff line numberDiff line change
@@ -23751,7 +23751,7 @@ index 841a41485af62470d833aba578069b19a0bd1e8d..409c1134327bfcc338c3ac5e658a83cc
2375123751
// CraftBukkit start
2375223752
public boolean isDebugging() {
2375323753
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
23754-
index f8c81d795b19e73d56d6e0196c75e441ab4c2bef..97a294d2f5c1ddf0af7ffec3e1425eb329c5751b 100644
23754+
index ac7bc193f7ea63cbbba73df49f54a17ef7cdec40..d2db6e3a4af13984b0a790fb38e83c253914a973 100644
2375523755
--- a/net/minecraft/server/dedicated/DedicatedServer.java
2375623756
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
2375723757
@@ -433,7 +433,33 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -26735,7 +26735,7 @@ index da793ad12565c36fffb26eb771ff68c76632caf7..db06f966077928419bfe469260f04d7d
2673526735
if (!passengers.equals(this.lastPassengers)) {
2673626736
this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit
2673726737
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
26738-
index 400b56657414177cd76a7b94c426dc7c886aa957..a275b17d0852d9d9bc850614713244e580ae81f1 100644
26738+
index d1f235ebd835f58cf0c703c3a64d29825d98e183..080091efc19bc768bb9a660f366c42e831225505 100644
2673926739
--- a/net/minecraft/server/level/ServerLevel.java
2674026740
+++ b/net/minecraft/server/level/ServerLevel.java
2674126741
@@ -170,7 +170,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@@ -27976,10 +27976,10 @@ index 4eb040006f5d41b47e5ac9df5d9f19c4315d6343..7fa41dea184b01891f45d8e404bc1cba
2797627976
this.generatingStep = generatingStep;
2797727977
this.cache = cache;
2797827978
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
27979-
index 5d88b2790710a885957ffcffc02fb99c917123c5..7d1d4abfb04829d8c4722e326c6c6b8fb2ab91f4 100644
27979+
index 7eebb494e38b57e81b4f92f0a96d3a4c610d86df..065f4c810439dde464529b54ae300ecfcb1c2c31 100644
2798027980
--- a/net/minecraft/server/players/PlayerList.java
2798127981
+++ b/net/minecraft/server/players/PlayerList.java
27982-
@@ -1312,7 +1312,7 @@ public abstract class PlayerList {
27982+
@@ -1317,7 +1317,7 @@ public abstract class PlayerList {
2798327983

2798427984
public void setViewDistance(int viewDistance) {
2798527985
this.viewDistance = viewDistance;
@@ -27988,7 +27988,7 @@ index 5d88b2790710a885957ffcffc02fb99c917123c5..7d1d4abfb04829d8c4722e326c6c6b8f
2798827988

2798927989
for (ServerLevel serverLevel : this.server.getAllLevels()) {
2799027990
if (serverLevel != null) {
27991-
@@ -1323,7 +1323,7 @@ public abstract class PlayerList {
27991+
@@ -1328,7 +1328,7 @@ public abstract class PlayerList {
2799227992

2799327993
public void setSimulationDistance(int simulationDistance) {
2799427994
this.simulationDistance = simulationDistance;
@@ -28372,7 +28372,7 @@ index 8cc5c0716392ba06501542ff5cbe71ee43979e5d..09fd99c9cbd23b5f3c899bfb00c9b896
2837228372
+ // Paper end - block counting
2837328373
}
2837428374
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
28375-
index 994791a83ca6712db3e74ca9aba4bfcd95a0ec6d..1b54cf07616a10d93e9336dbd299ba5f09678a28 100644
28375+
index 9b3b770f6986dd132da78fdc3626d334166ec52a..b2b61203438bb1fad1ee807729781718d2467155 100644
2837628376
--- a/net/minecraft/world/entity/Entity.java
2837728377
+++ b/net/minecraft/world/entity/Entity.java
2837828378
@@ -135,7 +135,7 @@ import net.minecraft.world.scores.ScoreHolder;

paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch

+7-2
Original file line numberDiff line numberDiff line change
@@ -931,13 +931,18 @@
931931
}
932932

933933
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
934-
@@ -671,8 +_,16 @@
934+
@@ -671,8 +_,21 @@
935935

936936
public void sendAllPlayerInfo(ServerPlayer player) {
937937
player.inventoryMenu.sendAllDataToRemote();
938938
- player.resetSentInfo();
939939
+ // entityplayer.resetSentInfo();
940-
+ player.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
940+
+ // Paper start - send all attributes
941+
+ // needs to be done because the ServerPlayer instance is being reused on respawn instead of getting replaced like on vanilla
942+
+ java.util.Collection<net.minecraft.world.entity.ai.attributes.AttributeInstance> syncableAttributes = player.getAttributes().getSyncableAttributes();
943+
+ player.getBukkitEntity().injectScaledMaxHealth(syncableAttributes, true);
944+
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket(player.getId(), syncableAttributes));
945+
+ // Paper end - send all attributes
941946
+ player.refreshEntityData(player); // CraftBukkit - SPIGOT-7218: sync metadata
942947
player.connection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected));
943948
+ // CraftBukkit start - from GameRules

0 commit comments

Comments
 (0)