Fix join game reading

This commit is contained in:
Nassim Jahnke 2022-05-23 19:32:54 +02:00
parent 08a583526e
commit dc9fe10779
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 4 additions and 2 deletions

View File

@ -135,7 +135,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
final CompoundTag dimensionCompound = (CompoundTag) dimension;
final StringTag nameTag = dimensionCompound.get("name");
final CompoundTag dimensionData = dimensionCompound.get("element");
dimensionsMap.put(nameTag.getValue(), dimensionData);
dimensionsMap.put(nameTag.getValue(), dimensionData.clone());
if (!found && nameTag.getValue().equals(dimensionKey)) {
wrapper.write(Type.NBT, dimensionData);
@ -156,6 +156,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
map(Type.VAR_INT); // Simulation distance
map(Type.BOOLEAN); // Reduced debug info
map(Type.BOOLEAN); // Show death screen
map(Type.BOOLEAN); // Debug
map(Type.BOOLEAN); // Flat
read(Type.OPTIONAL_GLOBAL_POSITION); // Read last death location
handler(worldDataTrackerHandler(1));

View File

@ -29,7 +29,8 @@ public final class DimensionRegistryStorage implements StorableObject {
private Map<String, CompoundTag> dimensions = new HashMap<>();
public @Nullable CompoundTag dimension(final String dimensionKey) {
return dimensions.get(dimensionKey);
final CompoundTag compoundTag = dimensions.get(dimensionKey);
return compoundTag != null ? compoundTag.clone() : null;
}
public void setDimensions(final Map<String, CompoundTag> dimensions) {