From 715b9ab4b50678c3b8e8708170cb81fc17a1556e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 6 Jun 2021 19:48:49 -0400 Subject: [PATCH] Change item names if acting as a replacement --- .../network/translators/item/ItemRegistry.java | 15 ++++++++++++--- .../translators/item/TranslatableItemEntry.java | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java index 2958e6f00..5bbf379f3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java @@ -404,13 +404,16 @@ public class ItemRegistry { "", bedrockBlockId, stackSize); } - } else if (entry.getKey().equals("minecraft:spectral_arrow") || entry.getKey().equals("minecraft:knowledge_book")) { - // These items don't exist on Java, so set up a container that indicates they should have custom names + } else if (entry.getKey().equals("minecraft:spectral_arrow") || entry.getKey().equals("minecraft:knowledge_book") + // To remove later... hopefully + || entry.getKey().contains("candle") || entry.getKey().equals("minecraft:bundle") || entry.getKey().equals("minecraft:sculk_sensor")) { + // These items don't exist on Bedrock, so set up a container that indicates they should have custom names itemEntry = new TranslatableItemEntry( entry.getKey(), bedrockIdentifier, itemIndex, bedrockId, entry.getValue().get("bedrock_data").intValue(), bedrockBlockId, stackSize); + GeyserConnector.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated."); } else { itemEntry = new ItemEntry( entry.getKey(), bedrockIdentifier, itemIndex, bedrockId, @@ -530,7 +533,13 @@ public class ItemRegistry { Set javaOnlyItems = new ObjectOpenHashSet<>(); Collections.addAll(javaOnlyItems, "minecraft:spectral_arrow", "minecraft:debug_stick", - "minecraft:knowledge_book", "minecraft:tipped_arrow", "minecraft:trader_llama_spawn_egg"); + "minecraft:knowledge_book", "minecraft:tipped_arrow", "minecraft:trader_llama_spawn_egg", + // To be removed in Bedrock 1.17.10... right??? RIGHT??? + "minecraft:candle", "minecraft:white_candle", "minecraft:orange_candle", "minecraft:magenta_candle", + "minecraft:light_blue_candle", "minecraft:yellow_candle", "minecraft:lime_candle", "minecraft:pink_candle", + "minecraft:gray_candle", "minecraft:light_gray_candle", "minecraft:cyan_candle", "minecraft:purple_candle", + "minecraft:blue_candle", "minecraft:brown_candle", "minecraft:green_candle", "minecraft:red_candle", "minecraft:black_candle", + "minecraft:bundle", "minecraft:sculk_sensor"); if (!usingFurnaceMinecart) { javaOnlyItems.add("minecraft:furnace_minecart"); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/TranslatableItemEntry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/TranslatableItemEntry.java index b4ea92a0e..3967abb17 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/TranslatableItemEntry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/TranslatableItemEntry.java @@ -36,6 +36,6 @@ public class TranslatableItemEntry extends ItemEntry { public TranslatableItemEntry(String javaIdentifier, String bedrockIdentifier, int javaId, int bedrockId, int bedrockData, int bedrockBlockId, int stackSize) { super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, bedrockBlockId, stackSize); - this.translationString = "item." + javaIdentifier.replace(":", "."); + this.translationString = (isBlock() ? "block." : "item.") + javaIdentifier.replace(":", "."); } }