diff options
Diffstat (limited to 'patches/server/0460-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch')
-rw-r--r-- | patches/server/0460-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/server/0460-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0460-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch new file mode 100644 index 0000000000..35e55d554a --- /dev/null +++ b/patches/server/0460-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 452789dc47393580374bf438e6229b1e6cd3832b..e3275f09f48c9e69179fd17901d4294ddb68a435 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -4493,4 +4493,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S + + void accept(Entity entity, double x, double y, double z); + } ++ ++ // Paper start ++ public static int nextEntityId() { ++ return ENTITY_COUNTER.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 2ff5d2c357a4832e2624ef53fb0110d61fddc6fc..88deea72f7456c178f54f6a245c84a64ffab6926 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -504,6 +504,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 + + /** |