mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Added UniqueId to entities. Thanks Afforess!
This commit is contained in:
parent
95c19d5f22
commit
d33c06ead2
@ -4,6 +4,8 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.entity.CraftVehicle;
|
import org.bukkit.craftbukkit.entity.CraftVehicle;
|
||||||
@ -83,6 +85,7 @@ public abstract class Entity {
|
|||||||
public int bH;
|
public int bH;
|
||||||
public int bI;
|
public int bI;
|
||||||
public boolean bJ;
|
public boolean bJ;
|
||||||
|
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
|
||||||
|
|
||||||
public Entity(World world) {
|
public Entity(World world) {
|
||||||
this.id = entityCount++;
|
this.id = entityCount++;
|
||||||
@ -900,6 +903,8 @@ public abstract class Entity {
|
|||||||
nbttagcompound.a("Air", (short) this.airTicks);
|
nbttagcompound.a("Air", (short) this.airTicks);
|
||||||
nbttagcompound.a("OnGround", this.onGround);
|
nbttagcompound.a("OnGround", this.onGround);
|
||||||
nbttagcompound.setString("World", world.worldData.name); // CraftBukkit
|
nbttagcompound.setString("World", world.worldData.name); // CraftBukkit
|
||||||
|
nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits()); // CraftBukkit
|
||||||
|
nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits()); // CraftBukkit
|
||||||
this.b(nbttagcompound);
|
this.b(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,6 +938,16 @@ public abstract class Entity {
|
|||||||
this.airTicks = nbttagcompound.d("Air");
|
this.airTicks = nbttagcompound.d("Air");
|
||||||
this.onGround = nbttagcompound.m("OnGround");
|
this.onGround = nbttagcompound.m("OnGround");
|
||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
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.c(this.yaw, this.pitch);
|
||||||
this.a(nbttagcompound);
|
this.a(nbttagcompound);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
protected final CraftServer server;
|
protected final CraftServer server;
|
||||||
@ -264,4 +265,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
public EntityDamageEvent getLastDamageCause() {
|
public EntityDamageEvent getLastDamageCause() {
|
||||||
return lastDamageEvent;
|
return lastDamageEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getUniqueId() {
|
||||||
|
return getHandle().uniqueId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user