mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
Handle missing SpawnEggs in MetaSpawnEgg
By: Doc <nachito94@msn.com>
This commit is contained in:
parent
8b26bb8f3e
commit
4a09aaa914
3 changed files with 22 additions and 2 deletions
|
@ -131,11 +131,13 @@ public final class CraftItemFactory implements ItemFactory {
|
||||||
case YELLOW_BANNER:
|
case YELLOW_BANNER:
|
||||||
case YELLOW_WALL_BANNER:
|
case YELLOW_WALL_BANNER:
|
||||||
return meta instanceof CraftMetaBanner ? meta : new CraftMetaBanner(meta);
|
return meta instanceof CraftMetaBanner ? meta : new CraftMetaBanner(meta);
|
||||||
|
case ALLAY_SPAWN_EGG:
|
||||||
case AXOLOTL_SPAWN_EGG:
|
case AXOLOTL_SPAWN_EGG:
|
||||||
case BAT_SPAWN_EGG:
|
case BAT_SPAWN_EGG:
|
||||||
case BEE_SPAWN_EGG:
|
case BEE_SPAWN_EGG:
|
||||||
case BLAZE_SPAWN_EGG:
|
case BLAZE_SPAWN_EGG:
|
||||||
case CAT_SPAWN_EGG:
|
case CAT_SPAWN_EGG:
|
||||||
|
case CAMEL_SPAWN_EGG:
|
||||||
case CAVE_SPIDER_SPAWN_EGG:
|
case CAVE_SPIDER_SPAWN_EGG:
|
||||||
case CHICKEN_SPAWN_EGG:
|
case CHICKEN_SPAWN_EGG:
|
||||||
case COD_SPAWN_EGG:
|
case COD_SPAWN_EGG:
|
||||||
|
@ -145,6 +147,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||||
case DONKEY_SPAWN_EGG:
|
case DONKEY_SPAWN_EGG:
|
||||||
case DROWNED_SPAWN_EGG:
|
case DROWNED_SPAWN_EGG:
|
||||||
case ELDER_GUARDIAN_SPAWN_EGG:
|
case ELDER_GUARDIAN_SPAWN_EGG:
|
||||||
|
case ENDER_DRAGON_SPAWN_EGG:
|
||||||
case ENDERMAN_SPAWN_EGG:
|
case ENDERMAN_SPAWN_EGG:
|
||||||
case ENDERMITE_SPAWN_EGG:
|
case ENDERMITE_SPAWN_EGG:
|
||||||
case EVOKER_SPAWN_EGG:
|
case EVOKER_SPAWN_EGG:
|
||||||
|
@ -156,6 +159,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||||
case HOGLIN_SPAWN_EGG:
|
case HOGLIN_SPAWN_EGG:
|
||||||
case HORSE_SPAWN_EGG:
|
case HORSE_SPAWN_EGG:
|
||||||
case HUSK_SPAWN_EGG:
|
case HUSK_SPAWN_EGG:
|
||||||
|
case IRON_GOLEM_SPAWN_EGG:
|
||||||
case LLAMA_SPAWN_EGG:
|
case LLAMA_SPAWN_EGG:
|
||||||
case MAGMA_CUBE_SPAWN_EGG:
|
case MAGMA_CUBE_SPAWN_EGG:
|
||||||
case MOOSHROOM_SPAWN_EGG:
|
case MOOSHROOM_SPAWN_EGG:
|
||||||
|
@ -179,6 +183,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||||
case SKELETON_HORSE_SPAWN_EGG:
|
case SKELETON_HORSE_SPAWN_EGG:
|
||||||
case SKELETON_SPAWN_EGG:
|
case SKELETON_SPAWN_EGG:
|
||||||
case SLIME_SPAWN_EGG:
|
case SLIME_SPAWN_EGG:
|
||||||
|
case SNOW_GOLEM_SPAWN_EGG:
|
||||||
case SPIDER_SPAWN_EGG:
|
case SPIDER_SPAWN_EGG:
|
||||||
case SQUID_SPAWN_EGG:
|
case SQUID_SPAWN_EGG:
|
||||||
case STRAY_SPAWN_EGG:
|
case STRAY_SPAWN_EGG:
|
||||||
|
@ -190,8 +195,10 @@ public final class CraftItemFactory implements ItemFactory {
|
||||||
case VILLAGER_SPAWN_EGG:
|
case VILLAGER_SPAWN_EGG:
|
||||||
case VINDICATOR_SPAWN_EGG:
|
case VINDICATOR_SPAWN_EGG:
|
||||||
case WANDERING_TRADER_SPAWN_EGG:
|
case WANDERING_TRADER_SPAWN_EGG:
|
||||||
|
case WARDEN_SPAWN_EGG:
|
||||||
case WITCH_SPAWN_EGG:
|
case WITCH_SPAWN_EGG:
|
||||||
case WITHER_SKELETON_SPAWN_EGG:
|
case WITHER_SKELETON_SPAWN_EGG:
|
||||||
|
case WITHER_SPAWN_EGG:
|
||||||
case WOLF_SPAWN_EGG:
|
case WOLF_SPAWN_EGG:
|
||||||
case ZOGLIN_SPAWN_EGG:
|
case ZOGLIN_SPAWN_EGG:
|
||||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||||
|
|
|
@ -394,11 +394,13 @@ public final class CraftItemStack extends ItemStack {
|
||||||
case YELLOW_BANNER:
|
case YELLOW_BANNER:
|
||||||
case YELLOW_WALL_BANNER:
|
case YELLOW_WALL_BANNER:
|
||||||
return new CraftMetaBanner(item.getTag());
|
return new CraftMetaBanner(item.getTag());
|
||||||
|
case ALLAY_SPAWN_EGG:
|
||||||
case AXOLOTL_SPAWN_EGG:
|
case AXOLOTL_SPAWN_EGG:
|
||||||
case BAT_SPAWN_EGG:
|
case BAT_SPAWN_EGG:
|
||||||
case BEE_SPAWN_EGG:
|
case BEE_SPAWN_EGG:
|
||||||
case BLAZE_SPAWN_EGG:
|
case BLAZE_SPAWN_EGG:
|
||||||
case CAT_SPAWN_EGG:
|
case CAT_SPAWN_EGG:
|
||||||
|
case CAMEL_SPAWN_EGG:
|
||||||
case CAVE_SPIDER_SPAWN_EGG:
|
case CAVE_SPIDER_SPAWN_EGG:
|
||||||
case CHICKEN_SPAWN_EGG:
|
case CHICKEN_SPAWN_EGG:
|
||||||
case COD_SPAWN_EGG:
|
case COD_SPAWN_EGG:
|
||||||
|
@ -408,6 +410,7 @@ public final class CraftItemStack extends ItemStack {
|
||||||
case DONKEY_SPAWN_EGG:
|
case DONKEY_SPAWN_EGG:
|
||||||
case DROWNED_SPAWN_EGG:
|
case DROWNED_SPAWN_EGG:
|
||||||
case ELDER_GUARDIAN_SPAWN_EGG:
|
case ELDER_GUARDIAN_SPAWN_EGG:
|
||||||
|
case ENDER_DRAGON_SPAWN_EGG:
|
||||||
case ENDERMAN_SPAWN_EGG:
|
case ENDERMAN_SPAWN_EGG:
|
||||||
case ENDERMITE_SPAWN_EGG:
|
case ENDERMITE_SPAWN_EGG:
|
||||||
case EVOKER_SPAWN_EGG:
|
case EVOKER_SPAWN_EGG:
|
||||||
|
@ -419,6 +422,7 @@ public final class CraftItemStack extends ItemStack {
|
||||||
case HOGLIN_SPAWN_EGG:
|
case HOGLIN_SPAWN_EGG:
|
||||||
case HORSE_SPAWN_EGG:
|
case HORSE_SPAWN_EGG:
|
||||||
case HUSK_SPAWN_EGG:
|
case HUSK_SPAWN_EGG:
|
||||||
|
case IRON_GOLEM_SPAWN_EGG:
|
||||||
case LLAMA_SPAWN_EGG:
|
case LLAMA_SPAWN_EGG:
|
||||||
case MAGMA_CUBE_SPAWN_EGG:
|
case MAGMA_CUBE_SPAWN_EGG:
|
||||||
case MOOSHROOM_SPAWN_EGG:
|
case MOOSHROOM_SPAWN_EGG:
|
||||||
|
@ -442,6 +446,7 @@ public final class CraftItemStack extends ItemStack {
|
||||||
case SKELETON_HORSE_SPAWN_EGG:
|
case SKELETON_HORSE_SPAWN_EGG:
|
||||||
case SKELETON_SPAWN_EGG:
|
case SKELETON_SPAWN_EGG:
|
||||||
case SLIME_SPAWN_EGG:
|
case SLIME_SPAWN_EGG:
|
||||||
|
case SNOW_GOLEM_SPAWN_EGG:
|
||||||
case SPIDER_SPAWN_EGG:
|
case SPIDER_SPAWN_EGG:
|
||||||
case SQUID_SPAWN_EGG:
|
case SQUID_SPAWN_EGG:
|
||||||
case STRAY_SPAWN_EGG:
|
case STRAY_SPAWN_EGG:
|
||||||
|
@ -452,9 +457,11 @@ public final class CraftItemStack extends ItemStack {
|
||||||
case VEX_SPAWN_EGG:
|
case VEX_SPAWN_EGG:
|
||||||
case VILLAGER_SPAWN_EGG:
|
case VILLAGER_SPAWN_EGG:
|
||||||
case VINDICATOR_SPAWN_EGG:
|
case VINDICATOR_SPAWN_EGG:
|
||||||
|
case WARDEN_SPAWN_EGG:
|
||||||
case WANDERING_TRADER_SPAWN_EGG:
|
case WANDERING_TRADER_SPAWN_EGG:
|
||||||
case WITCH_SPAWN_EGG:
|
case WITCH_SPAWN_EGG:
|
||||||
case WITHER_SKELETON_SPAWN_EGG:
|
case WITHER_SKELETON_SPAWN_EGG:
|
||||||
|
case WITHER_SPAWN_EGG:
|
||||||
case WOLF_SPAWN_EGG:
|
case WOLF_SPAWN_EGG:
|
||||||
case ZOGLIN_SPAWN_EGG:
|
case ZOGLIN_SPAWN_EGG:
|
||||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||||
|
|
|
@ -18,11 +18,13 @@ import org.bukkit.material.MaterialData;
|
||||||
public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
|
|
||||||
private static final Set<Material> SPAWN_EGG_MATERIALS = Sets.newHashSet(
|
private static final Set<Material> SPAWN_EGG_MATERIALS = Sets.newHashSet(
|
||||||
|
Material.ALLAY_SPAWN_EGG,
|
||||||
Material.AXOLOTL_SPAWN_EGG,
|
Material.AXOLOTL_SPAWN_EGG,
|
||||||
Material.BAT_SPAWN_EGG,
|
Material.BAT_SPAWN_EGG,
|
||||||
Material.BEE_SPAWN_EGG,
|
Material.BEE_SPAWN_EGG,
|
||||||
Material.BLAZE_SPAWN_EGG,
|
Material.BLAZE_SPAWN_EGG,
|
||||||
Material.CAT_SPAWN_EGG,
|
Material.CAT_SPAWN_EGG,
|
||||||
|
Material.CAMEL_SPAWN_EGG,
|
||||||
Material.CAVE_SPIDER_SPAWN_EGG,
|
Material.CAVE_SPIDER_SPAWN_EGG,
|
||||||
Material.CHICKEN_SPAWN_EGG,
|
Material.CHICKEN_SPAWN_EGG,
|
||||||
Material.COD_SPAWN_EGG,
|
Material.COD_SPAWN_EGG,
|
||||||
|
@ -32,6 +34,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
Material.DONKEY_SPAWN_EGG,
|
Material.DONKEY_SPAWN_EGG,
|
||||||
Material.DROWNED_SPAWN_EGG,
|
Material.DROWNED_SPAWN_EGG,
|
||||||
Material.ELDER_GUARDIAN_SPAWN_EGG,
|
Material.ELDER_GUARDIAN_SPAWN_EGG,
|
||||||
|
Material.ENDER_DRAGON_SPAWN_EGG,
|
||||||
Material.ENDERMAN_SPAWN_EGG,
|
Material.ENDERMAN_SPAWN_EGG,
|
||||||
Material.ENDERMITE_SPAWN_EGG,
|
Material.ENDERMITE_SPAWN_EGG,
|
||||||
Material.EVOKER_SPAWN_EGG,
|
Material.EVOKER_SPAWN_EGG,
|
||||||
|
@ -43,6 +46,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
Material.HOGLIN_SPAWN_EGG,
|
Material.HOGLIN_SPAWN_EGG,
|
||||||
Material.HORSE_SPAWN_EGG,
|
Material.HORSE_SPAWN_EGG,
|
||||||
Material.HUSK_SPAWN_EGG,
|
Material.HUSK_SPAWN_EGG,
|
||||||
|
Material.IRON_GOLEM_SPAWN_EGG,
|
||||||
Material.LLAMA_SPAWN_EGG,
|
Material.LLAMA_SPAWN_EGG,
|
||||||
Material.MAGMA_CUBE_SPAWN_EGG,
|
Material.MAGMA_CUBE_SPAWN_EGG,
|
||||||
Material.MOOSHROOM_SPAWN_EGG,
|
Material.MOOSHROOM_SPAWN_EGG,
|
||||||
|
@ -66,6 +70,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
Material.SKELETON_HORSE_SPAWN_EGG,
|
Material.SKELETON_HORSE_SPAWN_EGG,
|
||||||
Material.SKELETON_SPAWN_EGG,
|
Material.SKELETON_SPAWN_EGG,
|
||||||
Material.SLIME_SPAWN_EGG,
|
Material.SLIME_SPAWN_EGG,
|
||||||
|
Material.SNOW_GOLEM_SPAWN_EGG,
|
||||||
Material.SPIDER_SPAWN_EGG,
|
Material.SPIDER_SPAWN_EGG,
|
||||||
Material.SQUID_SPAWN_EGG,
|
Material.SQUID_SPAWN_EGG,
|
||||||
Material.STRAY_SPAWN_EGG,
|
Material.STRAY_SPAWN_EGG,
|
||||||
|
@ -76,8 +81,10 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
Material.VEX_SPAWN_EGG,
|
Material.VEX_SPAWN_EGG,
|
||||||
Material.VILLAGER_SPAWN_EGG,
|
Material.VILLAGER_SPAWN_EGG,
|
||||||
Material.VINDICATOR_SPAWN_EGG,
|
Material.VINDICATOR_SPAWN_EGG,
|
||||||
|
Material.WARDEN_SPAWN_EGG,
|
||||||
Material.WANDERING_TRADER_SPAWN_EGG,
|
Material.WANDERING_TRADER_SPAWN_EGG,
|
||||||
Material.WITCH_SPAWN_EGG,
|
Material.WITCH_SPAWN_EGG,
|
||||||
|
Material.WITHER_SPAWN_EGG,
|
||||||
Material.WITHER_SKELETON_SPAWN_EGG,
|
Material.WITHER_SKELETON_SPAWN_EGG,
|
||||||
Material.WOLF_SPAWN_EGG,
|
Material.WOLF_SPAWN_EGG,
|
||||||
Material.ZOGLIN_SPAWN_EGG,
|
Material.ZOGLIN_SPAWN_EGG,
|
||||||
|
@ -97,11 +104,10 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||||
CraftMetaSpawnEgg(CraftMetaItem meta) {
|
CraftMetaSpawnEgg(CraftMetaItem meta) {
|
||||||
super(meta);
|
super(meta);
|
||||||
|
|
||||||
if (!(meta instanceof CraftMetaSpawnEgg)) {
|
if (!(meta instanceof CraftMetaSpawnEgg egg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftMetaSpawnEgg egg = (CraftMetaSpawnEgg) meta;
|
|
||||||
this.spawnedType = egg.spawnedType;
|
this.spawnedType = egg.spawnedType;
|
||||||
|
|
||||||
updateMaterial(null); // Trigger type population
|
updateMaterial(null); // Trigger type population
|
||||||
|
|
Loading…
Reference in a new issue