mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 03:32:46 +01:00
2db85c553f
We will now store the world ID. It may not be used if the entity is loaded before the world in question is, but it might be used later on, should the entity come after the world. Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
37 lines
1.7 KiB
Diff
37 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MeFisto94 <MeFisto94@users.noreply.github.com>
|
|
Date: Fri, 28 Aug 2020 01:41:26 +0200
|
|
Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
|
|
non-conflicting Entity Ids
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index ec163bf527120a19cdc9fd7ccd69b6eb83d0bb54..48cbc44d5b502443be8205a6481d037f9fea491e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -3483,4 +3483,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
|
|
|
void accept(Entity entity, double d0, double d1, double d2);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ public static int nextEntityId() {
|
|
+ return entityCount.incrementAndGet();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
index 8049063ea37f3e0eac3f3a26703adc80fc99341a..5b03187f4d76e3052ee9abe0ee2774218d41b864 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -445,6 +445,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
|
|
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
|
|
}
|
|
+
|
|
+ public int nextEntityId() {
|
|
+ return net.minecraft.world.entity.Entity.nextEntityId();
|
|
+ }
|
|
// Paper end
|
|
|
|
/**
|