mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-09 02:29:50 -10:00
A respawn into another level of the same dimension type makes a new level
ClientPacketListener.handleRespawn keeps its ClientLevel only when the spawn's level key is the current level's, and makes a new one otherwise. Horizon compared the dimension type's name, so moving between two levels sharing a type (a data pack or mod dimension using the Overworld's) kept the old level's chunks and entities, and fired neither native_client_level_load nor native_client_level_unload. It now compares the level key the client last entered (heard_level), so such a move clears the world and fires both hooks, with the right level named on the next unload. Fixes #6316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
62bdd29b23
commit
0ccddf82b8
1 file changed
+3
-1
@@ -1997,7 +1997,9 @@ impl Game<'_> {
|
||||
dimension.has_skylight,
|
||||
)
|
||||
.unwrap_or_else(|_| super::Dim::from_id(&dimension.name).shape());
|
||||
let same = r.dimension.name == dimension.name && keep_world;
|
||||
// handleRespawn keeps the ClientLevel only for the same level key:
|
||||
// two levels sharing a dimension type are still two levels.
|
||||
let same = keep_world && r.heard_level.as_deref() == Some(spawn.dimension.as_str());
|
||||
r.chunk_format = Arc::new(
|
||||
r.chunk_format
|
||||
.with_dimension(&dimension)
|
||||
|
||||
Reference in new issue
Block a user