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
|
2023-06-08 01:44:11 +02:00
|
|
|
index 70c5cb20e230d8556612bb3b9728898b5d4d329c..d223777615fb3636784b33a1f562b7c8a6dff102 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
|
2023-06-08 01:44:11 +02:00
|
|
|
@@ -4336,4 +4336,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
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
|
2023-06-08 01:44:11 +02:00
|
|
|
index 447df549a0d371389b086327b06b74aa1d6647cd..cddf16549f45bbb9a598d5677fbc2195200ba876 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
|
2023-06-06 11:09:19 +02:00
|
|
|
@@ -514,6 +514,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
|
|
|
|
|
|
|
|
/**
|