38 Zeilen
1.7 KiB
Diff
38 Zeilen
1.7 KiB
Diff
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
|
|
index 344862c3f479ae7b6d4f929c9ef7882aba983ffb..e2301dbeb3d76684b2a0ab4262bb76cab3557789 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -3473,4 +3473,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
|
|
|
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
|
|
index 6fbface979f6f9ed97bb39ca91a29bffe05fddda..25af57d0ab191f6a29ae95cec764667e9c23bdd4 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -420,6 +420,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null);
|
|
}
|
|
|
|
+ public int nextEntityId() {
|
|
+ return net.minecraft.world.entity.Entity.nextEntityId();
|
|
+ }
|
|
+
|
|
// Paper end
|
|
|
|
/**
|