From f801dc05bd7dd286309637ea55ace559031b61f6 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Tue, 2 May 2023 21:09:07 +0200 Subject: [PATCH] Add support for new spawn eggs (#3688) --- .../registry/populator/ItemRegistryPopulator.java | 15 +++++++++++++-- core/src/main/resources/mappings | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index a1c001418..08eb343d9 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -74,9 +74,15 @@ public class ItemRegistryPopulator { } public static void populate() { + Map manualFallback = new HashMap<>(); + manualFallback.put(Items.ENDER_DRAGON_SPAWN_EGG, "minecraft:enderman_spawn_egg"); + manualFallback.put(Items.WITHER_SPAWN_EGG, "minecraft:wither_skeleton_spawn_egg"); + manualFallback.put(Items.SNOW_GOLEM_SPAWN_EGG, "minecraft:polar_bear_spawn_egg"); + manualFallback.put(Items.IRON_GOLEM_SPAWN_EGG, "minecraft:villager_spawn_egg"); + Map paletteVersions = new Object2ObjectOpenHashMap<>(); - paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.CODEC.getProtocolVersion(), Collections.emptyMap())); - paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.CODEC.getProtocolVersion(), Collections.emptyMap())); + paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.CODEC.getProtocolVersion(), manualFallback)); + paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.CODEC.getProtocolVersion(), manualFallback)); paletteVersions.put("1_19_60", new PaletteVersion(Bedrock_v567.CODEC.getProtocolVersion(), Collections.emptyMap())); paletteVersions.put("1_19_70", new PaletteVersion(Bedrock_v575.CODEC.getProtocolVersion(), Collections.emptyMap())); paletteVersions.put("1_19_80", new PaletteVersion(Bedrock_v582.CODEC.getProtocolVersion(), Collections.emptyMap())); @@ -176,6 +182,11 @@ public class ItemRegistryPopulator { Set javaOnlyItems = new ObjectOpenHashSet<>(); Collections.addAll(javaOnlyItems, Items.SPECTRAL_ARROW, Items.DEBUG_STICK, Items.KNOWLEDGE_BOOK, Items.TIPPED_ARROW, Items.BUNDLE); + // these spawn eggs exist in 1.19.60+; + if (palette.getValue().protocolVersion() < Bedrock_v567.CODEC.getProtocolVersion()) { + Collections.addAll(javaOnlyItems, Items.IRON_GOLEM_SPAWN_EGG, Items.SNOW_GOLEM_SPAWN_EGG, + Items.WITHER_SPAWN_EGG, Items.ENDER_DRAGON_SPAWN_EGG); + } javaOnlyItems.add(Items.DECORATED_POT); if (!customItemsAllowed) { javaOnlyItems.add(Items.FURNACE_MINECART); diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index 307a5fe26..56c3eee7a 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 307a5fe26f39954974a316696147a3b4f1b97001 +Subproject commit 56c3eee7a5241b5609d1936f2a11b05dd1a3d568