PaperMC/patches/server/0509-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
Jake Potrebic d33cdcf2e6
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e25c6a75 PR-638: Add CreativeCategory API for Materials

CraftBukkit Changes:
86292d3e0 PR-876: Add CreativeCategory API for Materials
2022-03-03 10:21:48 -08:00

37 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 bd285a7d84c934ec094099810eac1f03c09118e3..35825b598778e6b8aef613263abab1a8d4ab4af3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4013,4 +4013,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
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 008c15164a7affb785964f604f8fea93d28344ac..26936cb655aec0453c094e0993d43d65393a5579 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -502,6 +502,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}
+
+ public int nextEntityId() {
+ return net.minecraft.world.entity.Entity.nextEntityId();
+ }
// Paper end
/**