Class ItemTranslator
java.lang.Object
org.geysermc.geyser.translator.item.ItemTranslator
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinitiongetBedrockItemDefinition(GeyserSession session, @NonNull GeyserItemStack itemStack) Given an item stack, determine the Bedrock item definition that should be applied to Bedrock players.static StringgetCustomName(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping) Translates the display name of the itemstatic StringgetCustomName(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping, char translationColor) static voidtranslateCustomItem(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder builder, ItemMapping mapping) Translates the custom model data of an itemstatic @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.BuildertranslateToBedrock(GeyserSession session, int javaId, int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.BuildertranslateToBedrock(GeyserSession session, Item javaItem, ItemMapping bedrockItem, int count, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemDatatranslateToBedrock(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) static org.geysermc.mcprotocollib.protocol.data.game.item.ItemStacktranslateToJava(GeyserSession session, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData data)
-
Method Details
-
translateToJava
public static org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack translateToJava(GeyserSession session, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData data) -
translateToBedrock
public static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder translateToBedrock(GeyserSession session, int javaId, int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) -
translateToBedrock
public static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData translateToBedrock(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
translateToBedrock
public static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder translateToBedrock(GeyserSession session, Item javaItem, ItemMapping bedrockItem, int count, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) -
getBedrockItemDefinition
public static @NonNull org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition getBedrockItemDefinition(GeyserSession session, @NonNull GeyserItemStack itemStack) Given an item stack, determine the Bedrock item definition that should be applied to Bedrock players. -
getCustomName
public static String getCustomName(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping) Translates the display name of the item- Parameters:
session- the Bedrock client's sessioncomponents- the components to translatemapping- the item entry, in case it requires translation
-
getCustomName
public static String getCustomName(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping, char translationColor) - Parameters:
translationColor- if this item is not available on Java, the color that the new name should be. Normally, this should just be white, but for shulker boxes this should be gray.
-
translateCustomItem
public static void translateCustomItem(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder builder, ItemMapping mapping) Translates the custom model data of an item
-