Skip to content

Commit 8da8026

Browse files
committed
Remove world caching from Location to fix issue
1 parent 7f48acb commit 8da8026

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/Location.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public class Location implements java.io.Serializable {
4343
*/
4444
public String world;
4545

46-
// Cache world for efficiency
47-
private transient World worldRef;
48-
4946
/**
5047
* Creates a location
5148
*/
@@ -126,17 +123,13 @@ public Location(World world, double X, double Y, double Z, float rotation, float
126123
* dimension. May return null if the given world does not exist!
127124
*/
128125
public World getWorld() {
129-
if (worldRef == null) {
130-
OWorld oworld = etc.getMCServer().getWorld(world, dimension);
131-
worldRef = oworld == null ? null : oworld.world;
132-
}
133-
return worldRef;
126+
OWorld oworld = etc.getMCServer().getWorld(world, dimension);
127+
return oworld == null ? null : oworld.world;
134128
}
135129

136130
public void setWorld(World newWorld) {
137131
world = newWorld.getName();
138132
dimension = newWorld.getType().getId();
139-
worldRef = newWorld;
140133
}
141134

142135
/**

src/Player.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,7 @@ public void switchWorlds(World world) {
852852
|| world.getType() == World.Dimension.NORMAL
853853
&& this.getWorld().getType() == World.Dimension.END) {
854854
Location loc = this.getLocation();
855-
loc.world = world.getName(); // teleport to new world
856-
loc.dimension = world.getType().getId();
855+
loc.setWorld(world); // teleport to new world
857856

858857
// SRG mcServer.func_71203_ab().func_72368_a(ent, loc.dimension, true, loc); // Respawn with location
859858
mcServer.af().a(ent, loc.dimension, true, loc); // Respawn with location

0 commit comments

Comments
 (0)