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-11-04 18:42:38 +01:00
|
|
|
index 906a5cc5671b707ef90d1f25d8ba5642c7a483bc..3f0a44db707176c25e306f55fa63da9314d682a1 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-11-04 18:42:38 +01:00
|
|
|
@@ -4734,4 +4734,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
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-10-31 23:44:34 +01:00
|
|
|
index b50d1ddfd23bf1af16d86e5edcb72196b4674868..09a6a0c06580aea9e7be8de2189673d1a476f411 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-10-31 23:44:34 +01:00
|
|
|
@@ -527,6 +527,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
|
|
|
|
|
2024-10-27 18:11:15 +01:00
|
|
|
/**
|