aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch')
-rw-r--r--patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
new file mode 100644
index 0000000000..9806d3ed44
--- /dev/null
+++ b/patches/server/0404-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: MeFisto94 <[email protected]>
+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 d871b45ea22f1f2019ca1d1e0708d8861daec633..b8e63ccc00668713e5759aaf04597359870397f3 100644
+--- a/src/main/java/net/minecraft/world/entity/Entity.java
++++ b/src/main/java/net/minecraft/world/entity/Entity.java
+@@ -4760,4 +4760,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+
+ void accept(Entity entity, double x, double y, double z);
+ }
++
++ // Paper start - Expose entity id counter
++ public static int nextEntityId() {
++ return ENTITY_COUNTER.incrementAndGet();
++ }
++ // Paper end - Expose entity id counter
+ }
+diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+index 1e41803952f2410c8f1e213d8be8d141773853d3..78bc460fff7d537109883f1469500f6f536c598e 100644
+--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+@@ -527,6 +527,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
+ Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
+ return compound;
+ }
++
++ @Override
++ public int nextEntityId() {
++ return net.minecraft.world.entity.Entity.nextEntityId();
++ }
+ // Paper end
+
+ /**