Skip to content

Commit

Permalink
Fixup entity id
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 13, 2024
1 parent f2d504f commit 799d74e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,12 @@ public void onRespawn(ClientboundRespawnPacket packet) {
}

var oldLocalPlayer = localPlayer;
var newLocalPlayer = packet.isKeepMetadata() ? new LocalPlayer(connection, currentLevel(), botProfile, localPlayer.isShiftKeyDown(), localPlayer.isSprinting())
var newLocalPlayer = packet.isKeepMetadata() ? new LocalPlayer(connection, currentLevel(), botProfile, oldLocalPlayer.isShiftKeyDown(), oldLocalPlayer.isSprinting())
: new LocalPlayer(connection, currentLevel(), botProfile);
connection.inventoryManager().setContainer(0, localPlayer.inventory());
connection.inventoryManager().setContainer(0, newLocalPlayer.inventory());

this.startWaitingForNewLevel(newLocalPlayer, currentLevel());
localPlayer.entityId(oldLocalPlayer.entityId());
newLocalPlayer.entityId(oldLocalPlayer.entityId());

this.localPlayer = newLocalPlayer;
if (packet.isKeepMetadata()) {
Expand All @@ -321,7 +321,7 @@ public void onRespawn(ClientboundRespawnPacket packet) {
newLocalPlayer.attributeState().assignBaseValues(oldLocalPlayer.attributeState());
}

entityTrackerState.addEntity(localPlayer);
entityTrackerState.addEntity(newLocalPlayer);

this.gameModeState.adjustPlayer(newLocalPlayer);
newLocalPlayer.setReducedDebugInfo(oldLocalPlayer.isReducedDebugInfo());
Expand Down

0 comments on commit 799d74e

Please sign in to comment.