mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
39 lines
1.7 KiB
Diff
39 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 335962dfe50d8d691a2a1fc6224950641e2b5a2b..203aacc9e116c1335bde1cff4d59674bfa7a622a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4509,4 +4509,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 890beb473c240c084c4dd12c5dd792895117358e..5eeb2a46cb093d21ce7276373a838041be7a47b3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -530,6 +530,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
|
|
|
|
@Override
|