2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-03-23 22:26:17 +01:00
|
|
|
index f45b148884b305628411d57f7662ea454fde3906..44610d4e3fb69e6cf5629d9e895e93d8dd5e09e9 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2024-02-23 23:13:37 +01:00
|
|
|
@@ -4411,4 +4411,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
void accept(Entity entity, double x, double y, double z);
|
|
|
|
}
|
|
|
|
+
|
2024-01-20 12:50:16 +01:00
|
|
|
+ // Paper start - Expose entity id counter
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public static int nextEntityId() {
|
|
|
|
+ return ENTITY_COUNTER.incrementAndGet();
|
|
|
|
+ }
|
2024-01-20 12:50:16 +01:00
|
|
|
+ // Paper end - Expose entity id counter
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
2024-04-06 21:53:39 +02:00
|
|
|
index 7579e076793ba90e405b3ac0db600374ee8fdcb3..f4a7da134584a065a34b4f6a8eaebfcb81b6d735 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -525,6 +525,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
2023-02-15 23:10:14 +01:00
|
|
|
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
|
|
|
return compound;
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
2023-02-15 23:10:14 +01:00
|
|
|
+ @Override
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public int nextEntityId() {
|
|
|
|
+ return net.minecraft.world.entity.Entity.nextEntityId();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
/**
|