Fix: Manually translated item names for block items not showing up properly (#4857)

This commit is contained in:
chris 2024-07-13 22:00:15 +02:00 committed by GitHub
parent b0c7ddb68d
commit 6ab0186fc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,6 +59,7 @@ import org.geysermc.geyser.inventory.item.StoredItemMappings;
import org.geysermc.geyser.item.GeyserCustomMappingData; import org.geysermc.geyser.item.GeyserCustomMappingData;
import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.item.components.Rarity; import org.geysermc.geyser.item.components.Rarity;
import org.geysermc.geyser.item.type.BlockItem;
import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
@ -403,7 +404,7 @@ public class ItemRegistryPopulator {
if (javaOnlyItems.contains(javaItem) || javaItem.rarity() != Rarity.COMMON) { if (javaOnlyItems.contains(javaItem) || javaItem.rarity() != Rarity.COMMON) {
// These items don't exist on Bedrock, so set up a variable that indicates they should have custom names // These items don't exist on Bedrock, so set up a variable that indicates they should have custom names
// Or, ensure that we are translating these at all times to account for rarity colouring // Or, ensure that we are translating these at all times to account for rarity colouring
mappingBuilder = mappingBuilder.translationString((bedrockBlock != null ? "block." : "item.") + entry.getKey().replace(":", ".")); mappingBuilder = mappingBuilder.translationString((javaItem instanceof BlockItem ? "block." : "item.") + entry.getKey().replace(":", "."));
GeyserImpl.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated."); GeyserImpl.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated.");
} }