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/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index a236e0441fc20270b4c44ed5a7d5b94297949226..eeac4aeaf21b43647aa643ec55a1ae842a7ac197 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
 
 public class ItemMonsterEgg extends Item {
 
-    private static final Map<EntityTypes<?>, ItemMonsterEgg> a = Maps.newIdentityHashMap();
+    public static final Map<EntityTypes<?>, ItemMonsterEgg> a = Maps.newIdentityHashMap(); // Purpur - private -> public
     private final int b;
     private final int c;
     private final EntityTypes<?> d;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index c79623339cfe8fb8484bcc2a8c3eb119b9e83093..3a6a1f8ce0a30f2bdc08ec36fe9a2381439e7fa4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -396,4 +396,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.server.MinecraftKey key = new net.minecraft.server.MinecraftKey(name);
+        net.minecraft.server.EntityTypes types = net.minecraft.server.EntityTypes.getFromKey(key);
+        net.minecraft.server.ItemMonsterEgg egg = net.minecraft.server.ItemMonsterEgg.a.get(types);
+        return new net.minecraft.server.ItemStack(egg).asBukkitMirror();
+    }
+    // Purpur end
 }
