From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 5 Jul 2019 16:36:55 -0500
Subject: [PATCH] ItemFactory#getMonsterEgg


diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
index b16f338a001254c700fe4e10a5cec0d6dc7bd127..6afba641943717cc9c75420d9f3af1048543a17e 100644
--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java
+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
@@ -36,7 +36,7 @@ import net.minecraft.world.phys.Vec3;
 
 public class SpawnEggItem extends Item {
 
-    private static final Map<EntityType<? extends Mob>, SpawnEggItem> BY_ID = Maps.newIdentityHashMap();
+    public static final Map<EntityType<? extends Mob>, SpawnEggItem> BY_ID = Maps.newIdentityHashMap(); // Purpur - private -> public
     private final int backgroundColor;
     private final int highlightColor;
     private final EntityType<?> defaultType;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 1a8ff7339c58a4fffb051a090a7b8c34cb346a61..ae9919b5df569c0e6e4a42af57542c6ffb30960c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -407,4 +407,18 @@ public final class CraftItemFactory implements ItemFactory {
             new net.md_5.bungee.api.chat.TextComponent(customName));
     }
     // Paper end
+
+    // Purpur start
+    @Override
+    public ItemStack getMonsterEgg(org.bukkit.entity.EntityType type) {
+        if (type == null) {
+            return null;
+        }
+        String name = type.getKey().toString();
+        net.minecraft.resources.ResourceLocation key = new net.minecraft.resources.ResourceLocation(name);
+        net.minecraft.world.entity.EntityType<?> types = net.minecraft.world.entity.EntityType.getFromKey(key);
+        net.minecraft.world.item.SpawnEggItem egg = net.minecraft.world.item.SpawnEggItem.BY_ID.get(types);
+        return new net.minecraft.world.item.ItemStack(egg).asBukkitMirror();
+    }
+    // Purpur end
 }
