2020-08-28 01:44:21 +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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-03-16 17:37:33 +01:00
|
|
|
index 344862c3f479ae7b6d4f929c9ef7882aba983ffb..e2301dbeb3d76684b2a0ab4262bb76cab3557789 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-03-16 14:04:28 +01:00
|
|
|
@@ -3473,4 +3473,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-08-28 01:44:21 +02: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-16 08:19:45 +01:00
|
|
|
index 6fbface979f6f9ed97bb39ca91a29bffe05fddda..25af57d0ab191f6a29ae95cec764667e9c23bdd4 100644
|
2020-08-28 01:44:21 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
2021-03-09 02:11:17 +01:00
|
|
|
@@ -420,6 +420,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
2021-03-16 08:19:45 +01:00
|
|
|
return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null);
|
2020-08-28 01:44:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ public int nextEntityId() {
|
2021-03-16 08:19:45 +01:00
|
|
|
+ return net.minecraft.world.entity.Entity.nextEntityId();
|
2020-08-28 01:44:21 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
/**
|