Change item names if acting as a replacement

This commit is contained in:
Camotoy 2021-06-06 19:48:49 -04:00
parent 3cdc4c767d
commit 715b9ab4b5
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 13 additions and 4 deletions

View file

@ -404,13 +404,16 @@ public class ItemRegistry {
"", bedrockBlockId, "", bedrockBlockId,
stackSize); stackSize);
} }
} else if (entry.getKey().equals("minecraft:spectral_arrow") || entry.getKey().equals("minecraft:knowledge_book")) { } 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 // 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( itemEntry = new TranslatableItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId, entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
entry.getValue().get("bedrock_data").intValue(), entry.getValue().get("bedrock_data").intValue(),
bedrockBlockId, bedrockBlockId,
stackSize); stackSize);
GeyserConnector.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated.");
} else { } else {
itemEntry = new ItemEntry( itemEntry = new ItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId, entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
@ -530,7 +533,13 @@ public class ItemRegistry {
Set<String> javaOnlyItems = new ObjectOpenHashSet<>(); Set<String> javaOnlyItems = new ObjectOpenHashSet<>();
Collections.addAll(javaOnlyItems, "minecraft:spectral_arrow", "minecraft:debug_stick", 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) { if (!usingFurnaceMinecart) {
javaOnlyItems.add("minecraft:furnace_minecart"); javaOnlyItems.add("minecraft:furnace_minecart");
} }

View file

@ -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) { public TranslatableItemEntry(String javaIdentifier, String bedrockIdentifier, int javaId, int bedrockId, int bedrockData, int bedrockBlockId, int stackSize) {
super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, bedrockBlockId, stackSize); super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, bedrockBlockId, stackSize);
this.translationString = "item." + javaIdentifier.replace(":", "."); this.translationString = (isBlock() ? "block." : "item.") + javaIdentifier.replace(":", ".");
} }
} }