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 cedab1150..1a7abc3ec 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 @@ -81,6 +81,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.geyser.registry.type.NonVanillaItemRegistration; import org.geysermc.geyser.registry.type.PaletteItem; +import org.geysermc.geyser.util.MinecraftKey; import java.io.InputStream; import java.util.ArrayList; @@ -506,7 +507,7 @@ public class ItemRegistryPopulator { // ComponentItemData - used to register some custom properties componentItemData.add(customMapping.componentItemData()); - customItemDefinitions.put(identifierToKey(customItem.model()), customMapping); + customItemDefinitions.put(MinecraftKey.identifierToKey(customItem.model()), customMapping); registry.put(customMapping.integerId(), customMapping.itemDefinition()); customIdMappings.put(customMapping.integerId(), customItemIdentifier.toString()); @@ -735,11 +736,6 @@ public class ItemRegistryPopulator { componentItemData.add(new ComponentItemData("geysermc:furnace_minecart", builder.build())); } - // TODO this needs to be moved elsewhere - public static Key identifierToKey(Identifier identifier) { - return Key.key(identifier.namespace(), identifier.path()); - } - /** * Compares custom item definitions based on their predicates: * diff --git a/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java index 648d28b5c..ca660d692 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java @@ -41,7 +41,6 @@ import org.geysermc.geyser.api.util.Identifier; import org.geysermc.geyser.item.GeyserCustomMappingData; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.level.JavaDimension; -import org.geysermc.geyser.registry.populator.ItemRegistryPopulator; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.registry.RegistryEntryData; import org.geysermc.geyser.util.MinecraftKey; @@ -128,11 +127,11 @@ public final class CustomItemTranslator { return false; } RegistryEntryData registered = session.getRegistryCache().trimMaterials().entryById(trim.material().id()); - return ItemRegistryPopulator.identifierToKey(material).equals(registered.key()); + return MinecraftKey.identifierToKey(material).equals(registered.key()); } else if (match.property() == MatchPredicateProperty.CONTEXT_DIMENSION) { Identifier dimension = (Identifier) match.data(); RegistryEntryData registered = session.getRegistryCache().dimensions().entryByValue(session.getDimensionType()); - return ItemRegistryPopulator.identifierToKey(dimension).equals(registered.key()); + return MinecraftKey.identifierToKey(dimension).equals(registered.key()); } else if (match.property() == MatchPredicateProperty.CUSTOM_MODEL_DATA) { CustomModelDataString expected = (CustomModelDataString) match.data(); return expected.value().equals(getSafeCustomModelData(components, CustomModelData::strings, expected.index())); diff --git a/core/src/main/java/org/geysermc/geyser/util/MinecraftKey.java b/core/src/main/java/org/geysermc/geyser/util/MinecraftKey.java index 5f1c8e084..d2d54f579 100644 --- a/core/src/main/java/org/geysermc/geyser/util/MinecraftKey.java +++ b/core/src/main/java/org/geysermc/geyser/util/MinecraftKey.java @@ -26,6 +26,7 @@ package org.geysermc.geyser.util; import net.kyori.adventure.key.Key; +import org.geysermc.geyser.api.util.Identifier; import org.intellij.lang.annotations.Subst; public final class MinecraftKey { @@ -36,4 +37,8 @@ public final class MinecraftKey { public static Key key(@Subst("empty") String s) { return Key.key(s); } + + public static Key identifierToKey(Identifier identifier) { + return Key.key(identifier.namespace(), identifier.path()); + } }