mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 15:47:44 +01:00
38 lines
1.7 KiB
Diff
38 lines
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 11675a7611a42277ed0625509aa98a2f69611698..bda94c9c34c7f1f6b56103de5be253c619b576b2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4444,4 +4444,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
|
|
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
|
|
index 00dc3da665c295133931b80f92c19333d18b5f9a..8f8d69adb8e0a02f9540bc2feb1ccf9e6f635aab 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -512,6 +512,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
|
return compound;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public int nextEntityId() {
|
|
+ return net.minecraft.world.entity.Entity.nextEntityId();
|
|
+ }
|
|
// Paper end
|
|
|
|
/**
|