Paper/patches/api/0212-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
2024-04-25 22:47:32 +02:00

25 lines
952 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MeFisto94 <MeFisto94@users.noreply.github.com>
Date: Fri, 28 Aug 2020 01:41:31 +0200
Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
non-conflicting Entity Ids
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 30d869a7c4bba79b4c05de7860b31c14f47b341a..241cb853476ea35dad73d0234b2d030e9af23476 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -157,5 +157,12 @@ public interface UnsafeValues {
byte[] serializeItem(ItemStack item);
ItemStack deserializeItem(byte[] data);
+
+ /**
+ * Creates and returns the next EntityId available.
+ * <p>
+ * Use this when sending custom packets, so that there are no collisions on the client or server.
+ */
+ public int nextEntityId();
// Paper end
}