diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion685_671.java b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion685_671.java index 0c7f540bf..c72ea64b2 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion685_671.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion685_671.java @@ -46,8 +46,7 @@ public class Conversion685_671 { static GeyserMappingItem remapItem(Item item, GeyserMappingItem mapping) { mapping = Conversion712_685.remapItem(item, mapping); - - String identifer = mapping.getBedrockIdentifier(); + String identifier = mapping.getBedrockIdentifier(); if (NEW_MUSIC_DISCS.contains(item)) { return mapping.withBedrockIdentifier("minecraft:music_disc_otherside"); @@ -59,12 +58,12 @@ public class Conversion685_671 { return mapping.withBedrockIdentifier("minecraft:glass_bottle"); } - if (!NEW_BLOCKS.contains(identifer)) { + if (!NEW_BLOCKS.contains(identifier)) { return mapping; } - if (NEW_CORAL_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_CORAL_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:tube_coral_block" -> { return mapping.withBedrockIdentifier("minecraft:coral_block").withBedrockData(0); } case "minecraft:brain_coral_block" -> { return mapping.withBedrockIdentifier("minecraft:coral_block").withBedrockData(1); } case "minecraft:bubble_coral_block" -> { return mapping.withBedrockIdentifier("minecraft:coral_block").withBedrockData(2); } @@ -78,8 +77,8 @@ public class Conversion685_671 { } } - if (NEW_DOUBLE_PLANTS.contains(identifer)) { - switch (identifer) { + if (NEW_DOUBLE_PLANTS.contains(identifier)) { + switch (identifier) { case "minecraft:sunflower" -> { return mapping.withBedrockIdentifier("minecraft:double_plant").withBedrockData(0); } case "minecraft:lilac" -> { return mapping.withBedrockIdentifier("minecraft:double_plant").withBedrockData(1); } case "minecraft:tall_grass" -> { return mapping.withBedrockIdentifier("minecraft:double_plant").withBedrockData(2); } @@ -89,8 +88,8 @@ public class Conversion685_671 { } } - if (NEW_STONE_BLOCK_SLABS.contains(identifer)) { - switch (identifer) { + if (NEW_STONE_BLOCK_SLABS.contains(identifier)) { + switch (identifier) { case "minecraft:smooth_stone_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab").withBedrockData(0); } case "minecraft:sandstone_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab").withBedrockData(1); } case "minecraft:petrified_oak_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab").withBedrockData(2); } @@ -102,8 +101,8 @@ public class Conversion685_671 { } } - if (NEW_TALLGRASSES.contains(identifer)) { - switch (identifer) { + if (NEW_TALLGRASSES.contains(identifier)) { + switch (identifier) { case "minecraft:short_grass" -> { return mapping.withBedrockIdentifier("minecraft:tallgrass").withBedrockData(1); } case "minecraft:fern" -> { return mapping.withBedrockIdentifier("minecraft:tallgrass").withBedrockData(2); } } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion712_685.java b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion712_685.java index db715e015..45963cb90 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion712_685.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion712_685.java @@ -33,35 +33,34 @@ public class Conversion712_685 { static GeyserMappingItem remapItem(Item item, GeyserMappingItem mapping) { mapping = Conversion729_712.remapItem(item, mapping); + String identifier = mapping.getBedrockIdentifier(); - String identifer = mapping.getBedrockIdentifier(); - - if (!NEW_BLOCKS.contains(identifer)) { + if (!NEW_BLOCKS.contains(identifier)) { return mapping; } - if (identifer.equals("minecraft:coarse_dirt")) { + if (identifier.equals("minecraft:coarse_dirt")) { return mapping.withBedrockIdentifier("minecraft:dirt").withBedrockData(1); } - if (identifer.equals("minecraft:dandelion")) { + if (identifier.equals("minecraft:dandelion")) { return mapping.withBedrockIdentifier("minecraft:yellow_flower").withBedrockData(0); } - if (identifer.equals("minecraft:red_sand")) { + if (identifier.equals("minecraft:red_sand")) { return mapping.withBedrockIdentifier("minecraft:sand").withBedrockData(1); } - if (NEW_PRISMARINE_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_PRISMARINE_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:prismarine" -> { return mapping.withBedrockIdentifier("minecraft:prismarine").withBedrockData(0); } case "minecraft:dark_prismarine" -> { return mapping.withBedrockIdentifier("minecraft:prismarine").withBedrockData(1); } case "minecraft:prismarine_bricks" -> { return mapping.withBedrockIdentifier("minecraft:prismarine").withBedrockData(2); } } } - if (NEW_SANDSTONE_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_SANDSTONE_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:sandstone" -> { return mapping.withBedrockIdentifier("minecraft:sandstone").withBedrockData(0); } case "minecraft:chiseled_sandstone" -> { return mapping.withBedrockIdentifier("minecraft:sandstone").withBedrockData(1); } case "minecraft:cut_sandstone" -> { return mapping.withBedrockIdentifier("minecraft:sandstone").withBedrockData(2); } @@ -69,8 +68,8 @@ public class Conversion712_685 { } } - if (NEW_RED_SANDSTONE_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_RED_SANDSTONE_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:red_sandstone" -> { return mapping.withBedrockIdentifier("minecraft:red_sandstone").withBedrockData(0); } case "minecraft:chiseled_red_sandstone" -> { return mapping.withBedrockIdentifier("minecraft:red_sandstone").withBedrockData(1); } case "minecraft:cut_red_sandstone" -> { return mapping.withBedrockIdentifier("minecraft:red_sandstone").withBedrockData(2); } @@ -78,8 +77,8 @@ public class Conversion712_685 { } } - if (NEW_QUARTZ_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_QUARTZ_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:quartz_block" -> { return mapping.withBedrockIdentifier("minecraft:quartz_block").withBedrockData(0); } case "minecraft:chiseled_quartz_block" -> { return mapping.withBedrockIdentifier("minecraft:quartz_block").withBedrockData(1); } case "minecraft:quartz_pillar" -> { return mapping.withBedrockIdentifier("minecraft:quartz_block").withBedrockData(2); } @@ -87,8 +86,8 @@ public class Conversion712_685 { } } - if (NEW_STONE_BLOCK_SLABS_2.contains(identifer)) { - switch (identifer) { + if (NEW_STONE_BLOCK_SLABS_2.contains(identifier)) { + switch (identifier) { case "minecraft:red_sandstone_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab2").withBedrockData(0); } case "minecraft:purpur_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab2").withBedrockData(1); } case "minecraft:prismarine_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab2").withBedrockData(2); } @@ -100,8 +99,8 @@ public class Conversion712_685 { } } - if (NEW_STONE_BLOCK_SLABS_3.contains(identifer)) { - switch (identifer) { + if (NEW_STONE_BLOCK_SLABS_3.contains(identifier)) { + switch (identifier) { case "minecraft:end_stone_brick_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab3").withBedrockData(0); } case "minecraft:smooth_red_sandstone_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab3").withBedrockData(1); } case "minecraft:polished_andesite_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab3").withBedrockData(2); } @@ -113,8 +112,8 @@ public class Conversion712_685 { } } - if (NEW_STONE_BLOCK_SLABS_4.contains(identifer)) { - switch (identifer) { + if (NEW_STONE_BLOCK_SLABS_4.contains(identifier)) { + switch (identifier) { case "minecraft:mossy_stone_brick_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab4").withBedrockData(0); } case "minecraft:smooth_quartz_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab4").withBedrockData(1); } case "minecraft:normal_stone_slab" -> { return mapping.withBedrockIdentifier("minecraft:stone_block_slab4").withBedrockData(2); } @@ -123,8 +122,8 @@ public class Conversion712_685 { } } - if (NEW_MONSTER_EGGS.contains(identifer)) { - switch (identifer) { + if (NEW_MONSTER_EGGS.contains(identifier)) { + switch (identifier) { case "minecraft:infested_stone" -> { return mapping.withBedrockIdentifier("minecraft:monster_egg").withBedrockData(0); } case "minecraft:infested_cobblestone" -> { return mapping.withBedrockIdentifier("minecraft:monster_egg").withBedrockData(1); } case "minecraft:infested_stone_bricks" -> { return mapping.withBedrockIdentifier("minecraft:monster_egg").withBedrockData(2); } @@ -134,8 +133,8 @@ public class Conversion712_685 { } } - if (NEW_STONEBRICK_BLOCKS.contains(identifer)) { - switch (identifer) { + if (NEW_STONEBRICK_BLOCKS.contains(identifier)) { + switch (identifier) { case "minecraft:stone_bricks" -> { return mapping.withBedrockIdentifier("minecraft:stonebrick").withBedrockData(0); } case "minecraft:mossy_stone_bricks" -> { return mapping.withBedrockIdentifier("minecraft:stonebrick").withBedrockData(1); } case "minecraft:cracked_stone_bricks" -> { return mapping.withBedrockIdentifier("minecraft:stonebrick").withBedrockData(2); } @@ -143,8 +142,8 @@ public class Conversion712_685 { } } - if (NEW_ANVILS.contains(identifer)) { - switch (identifer) { + if (NEW_ANVILS.contains(identifier)) { + switch (identifier) { case "minecraft:anvil" -> { return mapping.withBedrockIdentifier("minecraft:anvil").withBedrockData(0); } case "minecraft:chipped_anvil" -> { return mapping.withBedrockIdentifier("minecraft:anvil").withBedrockData(4); } case "minecraft:damaged_anvil" -> { return mapping.withBedrockIdentifier("minecraft:anvil").withBedrockData(8); } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion729_712.java b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion729_712.java index 5d4ebdc47..fbc2233bc 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion729_712.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion729_712.java @@ -16,6 +16,7 @@ public class Conversion729_712 { private static final List NEW_BLOCKS = Stream.of(NEW_PURPUR_BLOCKS, NEW_WALL_BLOCKS, NEW_SPONGE_BLOCKS, NEW_TNT_BLOCKS, STRUCTURE_VOID).flatMap(List::stream).toList(); static GeyserMappingItem remapItem(Item item, GeyserMappingItem mapping) { + mapping = Conversion748_729.remapItem(item, mapping); String identifier = mapping.getBedrockIdentifier(); if (!NEW_BLOCKS.contains(identifier)) { diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion748_729.java b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion748_729.java new file mode 100644 index 000000000..7a2d1a0cb --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/Conversion748_729.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.registry.populator; + +import org.geysermc.geyser.item.type.Item; +import org.geysermc.geyser.registry.type.GeyserMappingItem; + +import java.util.Map; + +public class Conversion748_729 { + + private static final Map NEW_PLAYER_HEADS = Map.of("minecraft:skeleton_skull", 0, "minecraft:wither_skeleton_skull", 1, "minecraft:zombie_head", 2, "minecraft:player_head", 3, "minecraft:creeper_head", 4, "minecraft:dragon_head", 5, "minecraft:piglin_head", 6); + + static GeyserMappingItem remapItem(Item item, GeyserMappingItem mapping) { + String identifier = mapping.getBedrockIdentifier(); + + if (NEW_PLAYER_HEADS.containsKey(identifier)) { + return mapping.withBedrockIdentifier("minecraft:skull") + .withBedrockData(NEW_PLAYER_HEADS.get(identifier)); + } + + return mapping; + } + +} 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 0b61c7999..65a35aa50 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 @@ -113,14 +113,8 @@ public class ItemRegistryPopulator { paletteVersions.add(new PaletteVersion("1_20_80", Bedrock_v671.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion685_671::remapItem)); paletteVersions.add(new PaletteVersion("1_21_0", Bedrock_v685.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion712_685::remapItem)); paletteVersions.add(new PaletteVersion("1_21_20", Bedrock_v712.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion729_712::remapItem)); - paletteVersions.add(new PaletteVersion("1_21_30", Bedrock_v729.CODEC.getProtocolVersion())); - paletteVersions.add(new PaletteVersion("1_21_40", Bedrock_v748.CODEC.getProtocolVersion(), Collections.emptyMap(), (item, mapping) -> { - String identifier = item.javaIdentifier(); - if (identifier.endsWith("_head") || identifier.endsWith("_skull")) { - return mapping.withBedrockIdentifier(item.javaIdentifier()); - } - return mapping; - })); + paletteVersions.add(new PaletteVersion("1_21_30", Bedrock_v729.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion748_729::remapItem)); + paletteVersions.add(new PaletteVersion("1_21_40", Bedrock_v748.CODEC.getProtocolVersion())); GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index 93f207e7e..a6d04157d 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 93f207e7e9d73f58a7c8902f7deda9dcb0524c8e +Subproject commit a6d04157d1866e55e35f2ce3ebde3cf4e007aabf