diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-06-07 04:21:33 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-06-07 04:21:33 -0400 |
commit | d33c06ead26d635d781753c936c408c3d420842f (patch) | |
tree | f8851286efa3ab3d5a959e416ae7538b9577eb9d /src/main/java/net | |
parent | 95c19d5f226d0af7c20073602131590d6b7bbb44 (diff) | |
download | craftbukkit-d33c06ead26d635d781753c936c408c3d420842f.tar craftbukkit-d33c06ead26d635d781753c936c408c3d420842f.tar.gz craftbukkit-d33c06ead26d635d781753c936c408c3d420842f.tar.lz craftbukkit-d33c06ead26d635d781753c936c408c3d420842f.tar.xz craftbukkit-d33c06ead26d635d781753c936c408c3d420842f.zip |
Added UniqueId to entities. Thanks Afforess!
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index cb23f89c..8e936c60 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Random; // CraftBukkit start +import java.util.UUID; + import org.bukkit.Bukkit; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.entity.CraftVehicle; @@ -83,6 +85,7 @@ public abstract class Entity { public int bH; public int bI; public boolean bJ; + public UUID uniqueId = UUID.randomUUID(); // CraftBukkit public Entity(World world) { this.id = entityCount++; @@ -900,6 +903,8 @@ public abstract class Entity { nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("OnGround", this.onGround); nbttagcompound.setString("World", world.worldData.name); // CraftBukkit + nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits()); // CraftBukkit + nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits()); // CraftBukkit this.b(nbttagcompound); } @@ -933,6 +938,16 @@ public abstract class Entity { this.airTicks = nbttagcompound.d("Air"); this.onGround = nbttagcompound.m("OnGround"); this.setPosition(this.locX, this.locY, this.locZ); + + // CraftBukkit start + long least = nbttagcompound.f("UUIDLeast"); + long most = nbttagcompound.f("UUIDMost"); + + if (least != 0L && most != 0L) { + this.uniqueId = new UUID(most, least); + } + // CraftBukkit end + this.c(this.yaw, this.pitch); this.a(nbttagcompound); |