geforkt von Mirrors/Paper
d5f1ffc2e6
With the new chunk system it doesn't hurt too much to (temporarily) remove this until implemented in a safer manner
29 Zeilen
1.5 KiB
Diff
29 Zeilen
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 14 Oct 2021 12:09:39 -0500
|
|
Subject: [PATCH] Add ItemFactory#getSpawnEgg API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
index 6da68728ead8eeb986baeb8bb0a3503307f5b70b..a7370f440dbcde6bf56deb1c1763baaa2a30da88 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
@@ -474,5 +474,17 @@ public final class CraftItemFactory implements ItemFactory {
|
|
entity.getUniqueId().toString(),
|
|
new net.md_5.bungee.api.chat.TextComponent(customName));
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public ItemStack getSpawnEgg(org.bukkit.entity.EntityType type) {
|
|
+ if (type == null) {
|
|
+ return null;
|
|
+ }
|
|
+ String typeId = type.getKey().toString();
|
|
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
|
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(typeKey);
|
|
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
|
|
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
|
+ }
|
|
// Paper end
|
|
}
|