Handle missing Spawn Egg item meta for 1.17 mobs (#6700)

This commit is contained in:
chickeneer 2021-10-04 03:13:19 -05:00 committed by GitHub
parent e3ef4987be
commit 7ebf08a6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Sat, 2 Oct 2021 10:14:04 -0500
Subject: [PATCH] Register spawn egg meta for 1.17 mobs
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 1a8ff7339c58a4fffb051a090a7b8c34cb346a61..aa7fd5c80712fecca1110341a234f60e8607b809 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -122,6 +122,7 @@ public final class CraftItemFactory implements ItemFactory {
case YELLOW_BANNER:
case YELLOW_WALL_BANNER:
return meta instanceof CraftMetaBanner ? meta : new CraftMetaBanner(meta);
+ case AXOLOTL_SPAWN_EGG: // Paper
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
@@ -140,6 +141,8 @@ public final class CraftItemFactory implements ItemFactory {
case EVOKER_SPAWN_EGG:
case FOX_SPAWN_EGG:
case GHAST_SPAWN_EGG:
+ case GLOW_SQUID_SPAWN_EGG: // Paper
+ case GOAT_SPAWN_EGG: // Paper
case GUARDIAN_SPAWN_EGG:
case HOGLIN_SPAWN_EGG:
case HORSE_SPAWN_EGG:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index e9fa60755da0bc358020266ff4e450e1b31da595..f6a820e2456c66b8db4140984e0306bea3ee4e9b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -349,6 +349,7 @@ public final class CraftItemStack extends ItemStack {
case YELLOW_BANNER:
case YELLOW_WALL_BANNER:
return new CraftMetaBanner(item.getTag());
+ case AXOLOTL_SPAWN_EGG: // Paper
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
@@ -367,6 +368,8 @@ public final class CraftItemStack extends ItemStack {
case EVOKER_SPAWN_EGG:
case FOX_SPAWN_EGG:
case GHAST_SPAWN_EGG:
+ case GLOW_SQUID_SPAWN_EGG: // Paper
+ case GOAT_SPAWN_EGG: // Paper
case GUARDIAN_SPAWN_EGG:
case HOGLIN_SPAWN_EGG:
case HORSE_SPAWN_EGG:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
index 31d649ad03fb80374155a3a276066a4c668d02f4..c485f2cb13cdaae2afdd047c55ae0c7d3fab3d49 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
@@ -112,6 +112,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
@Override
boolean applicableTo(Material type) {
switch (type) {
+ case AXOLOTL_SPAWN_EGG: // Paper
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
@@ -130,6 +131,8 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
case EVOKER_SPAWN_EGG:
case FOX_SPAWN_EGG:
case GHAST_SPAWN_EGG:
+ case GLOW_SQUID_SPAWN_EGG: // Paper
+ case GOAT_SPAWN_EGG: // Paper
case GUARDIAN_SPAWN_EGG:
case HOGLIN_SPAWN_EGG:
case HORSE_SPAWN_EGG: