Skip to content

Commit 2ddd0d8

Browse files
authored
[ci skip] Clarify respawn metadata resending (#612)
1 parent f978841 commit 2ddd0d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/src/main/java/com/viaversion/viarewind/protocol/v1_8to1_7_6_10/rewriter/PlayerPacketRewriter1_8.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ public void register() {
126126
return;
127127
}
128128

129-
// TODO figure out why this is needed
129+
// On 1.8 clients when the player respawns it keeps all metadata and sets player back to max HP
130+
// 1.7 clients do not copy the metadata but do set the health to max HP
131+
// to match the same client logic we remove the HP metadata as otherwise the client would be set to their old HP before respawning
130132
final List<EntityData> entityDataList = new ArrayList<>(tracker.getEntityData());
131133
entityDataList.removeIf(entityData -> entityData.id() == 6);
132134

133-
// 1.8 clients do keep entity data after respawn, 1.7 clients don't
134135
final PacketWrapper setEntityData = PacketWrapper.create(ClientboundPackets1_7_2_5.SET_ENTITY_DATA, wrapper.user());
135136
setEntityData.write(Types.INT, tracker.clientEntityId());
136137
setEntityData.write(RewindTypes.ENTITY_DATA_LIST1_7, entityDataList);

0 commit comments

Comments
 (0)