Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 21:10:17 +01:00
Added UniqueId to entities. Thanks Afforess!
Dieser Commit ist enthalten in:
Ursprung
95c19d5f22
Commit
d33c06ead2
@ -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);
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
protected final CraftServer server;
|
||||
@ -264,4 +265,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public EntityDamageEvent getLastDamageCause() {
|
||||
return lastDamageEvent;
|
||||
}
|
||||
|
||||
public UUID getUniqueId() {
|
||||
return getHandle().uniqueId;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren