Skip to content

Commit cd5c211

Browse files
Fix dimension query (#4259)
This fixes getting an offline player's location via User#worldKey() At some point, it was renamed to Dimension instead of WorldKey I suppose
1 parent 7bd89ec commit cd5c211

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main/java/org/spongepowered/common/entity/SpongeEntityArchetype.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public EntitySnapshot toSnapshot(final ServerLocation location) {
172172
final CompoundTag newCompound = this.compound.copy();
173173
final Vector3d pos = location.position();
174174
newCompound.put(Constants.Entity.ENTITY_POSITION, Constants.NBT.newDoubleNBTList(pos.x(), pos.y(), pos.z()));
175-
newCompound.putString(Constants.Sponge.World.WORLD_KEY, location.worldKey().formatted());
175+
newCompound.putString(Constants.Sponge.World.DIMENSION, location.worldKey().formatted());
176176
builder.compound = newCompound;
177177
builder.worldKey = location.world().properties().key();
178178
builder.position = pos;

src/main/java/org/spongepowered/common/entity/player/SpongeUserData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ public void readCompound(final CompoundTag compound) {
220220
this.reset();
221221
this.compound = compound;
222222

223-
if (!compound.contains(Constants.Sponge.World.WORLD_KEY)) {
224-
this.worldKey = ResourceKey.resolve(compound.getString(Constants.Sponge.World.WORLD_KEY));
223+
if (!compound.contains(Constants.Sponge.World.DIMENSION)) {
224+
this.worldKey = ResourceKey.resolve(compound.getString(Constants.Sponge.World.DIMENSION));
225225
}
226226
final ListTag position = compound.getList(Constants.Entity.ENTITY_POSITION, Constants.NBT.TAG_DOUBLE);
227227
final ListTag rotation = compound.getList(Constants.Entity.ENTITY_ROTATION, Constants.NBT.TAG_FLOAT);
@@ -238,7 +238,7 @@ public void readCompound(final CompoundTag compound) {
238238

239239
public void writeCompound(final CompoundTag compound) {
240240

241-
compound.putString(Constants.Sponge.World.WORLD_KEY, this.worldKey.formatted());
241+
compound.putString(Constants.Sponge.World.DIMENSION, this.worldKey.formatted());
242242

243243
this.loadInventory();
244244
this.loadEnderInventory();

src/main/java/org/spongepowered/common/util/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public static final class World {
287287
public static final String LEVEL_SPONGE_DAT_NEW = org.spongepowered.common.util.Constants.Sponge.World.LEVEL_SPONGE_DAT + "_new";
288288
public static final String UNIQUE_ID = "UUID";
289289
public static final String DIMENSIONS_DIRECTORY = "dimensions";
290-
public static final String WORLD_KEY = "WorldKey";
290+
public static final String DIMENSION = "Dimension";
291291
}
292292

293293
public static final class Schematic {

0 commit comments

Comments
 (0)