2020-08-27 23:44:21 +00: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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2021-03-03 00:27:34 +00:00
|
|
|
index a7b225249f7ffafa2c6e1fc60657067229e02960..fcb5cf78d1deff3c2593c7470f5501be8fed567b 100644
|
2020-08-27 23:44:21 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2021-01-11 01:44:06 +00:00
|
|
|
@@ -3382,4 +3382,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-08-27 23:44:21 +00:00
|
|
|
|
|
|
|
void accept(Entity entity, double d0, double d1, double d2);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ public static int nextEntityId() {
|
|
|
|
+ return entityCount.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
|
2021-03-03 00:27:34 +00:00
|
|
|
index 8f13e2685b8e68005d2c4d1613089f4d606fba94..f37ab6dc33cda2aeb997db060b255acda3316b61 100644
|
2020-08-27 23:44:21 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
2021-03-03 00:27:34 +00:00
|
|
|
@@ -413,6 +413,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
2020-08-27 23:44:21 +00:00
|
|
|
return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int nextEntityId() {
|
|
|
|
+ return net.minecraft.server.Entity.nextEntityId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
/**
|