summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/Entity.java
diff options
context:
space:
mode:
authorRigby <rigby@onarandombox.com>2011-07-05 04:48:27 +0100
committerEvilSeph <evilseph@unaligned.org>2011-07-07 14:20:05 -0400
commit9ced39421f6a4009ffbf6eac4167af68fa64f842 (patch)
treed0e13658201d97ed318808ad97a20addee18e6cd /src/main/java/net/minecraft/server/Entity.java
parent5515ce1ff6e9f64a385025e4edc0da1f1578893f (diff)
downloadcraftbukkit-9ced39421f6a4009ffbf6eac4167af68fa64f842.tar
craftbukkit-9ced39421f6a4009ffbf6eac4167af68fa64f842.tar.gz
craftbukkit-9ced39421f6a4009ffbf6eac4167af68fa64f842.tar.lz
craftbukkit-9ced39421f6a4009ffbf6eac4167af68fa64f842.tar.xz
craftbukkit-9ced39421f6a4009ffbf6eac4167af68fa64f842.zip
Implements a World UID.
Diffstat (limited to 'src/main/java/net/minecraft/server/Entity.java')
-rw-r--r--src/main/java/net/minecraft/server/Entity.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4edecff6..a786cc7c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -910,7 +910,7 @@ public abstract class Entity {
nbttagcompound.a("Air", (short) this.airTicks);
nbttagcompound.a("OnGround", this.onGround);
// CraftBukkit start
- nbttagcompound.setString("World", this.world.worldData.name);
+ nbttagcompound.setLong("WorldUID", this.world.worldData.getWorldUID());
nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
// CraftBukkit end
@@ -982,17 +982,24 @@ public abstract class Entity {
org.bukkit.Server server = Bukkit.getServer();
org.bukkit.World bworld = null;
+ // TODO: Remove World related checks, replaced with WorldUID.
if (this instanceof EntityPlayer) {
EntityPlayer entityPlayer = (EntityPlayer) this;
String worldName = nbttagcompound.getString("World");
- if (worldName == "") {
+ if (nbttagcompound.hasKey("WorldUID")) {
+ bworld = server.getWorld(nbttagcompound.getLong("WorldUID"));
+ } else if ("".equals(worldName)) {
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
} else {
bworld = server.getWorld(worldName);
}
} else {
- bworld = server.getWorld(nbttagcompound.getString("World"));
+ if (nbttagcompound.hasKey("WorldUID")) {
+ bworld = server.getWorld(nbttagcompound.getLong("WorldUID"));
+ } else {
+ bworld = server.getWorld(nbttagcompound.getString("World"));
+ }
}
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());