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-04-24 15:46:45 +02:00
|
|
|
index c8e4e37b706bd8cb9698ac2d13d0d8668e2d1d14..909575a02bf5f7040eb9c8edb034e7b6578e92b9 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-04-24 15:46:45 +02:00
|
|
|
@@ -4439,4 +4439,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-04-30 10:21:16 +02:00
|
|
|
index 54e5d76e5ec40912a5c09123d879cd5bef8da4b1..9b199fffb86cb04b9ad0013316a911ccf59d4051 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-30 10:21:16 +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
|
|
|
|
|
|
|
|
/**
|