Class ItemTranslator

java.lang.Object
org.geysermc.geyser.translator.inventory.item.ItemTranslator

public final class ItemTranslator extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition
    Given an item stack, determine the Bedrock item definition that should be applied to Bedrock players.
    static void
    translateCustomItem(com.github.steveice10.opennbt.tag.builtin.CompoundTag nbt, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder builder, ItemMapping mapping)
    Translates the custom model data of an item
    static com.github.steveice10.opennbt.tag.builtin.CompoundTag
    translateDisplayProperties(GeyserSession session, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag, ItemMapping mapping)
    Translates the display name of the item
    static com.github.steveice10.opennbt.tag.builtin.CompoundTag
    translateDisplayProperties(GeyserSession session, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag, ItemMapping mapping, char translationColor)
     
    static org.cloudburstmc.nbt.NbtMap
    translateNbtToBedrock(com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
     
    static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder
    translateToBedrock(GeyserSession session, int javaId, int count, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
     
    static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData
    translateToBedrock(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack stack)
     
    static com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack
    translateToJava(org.cloudburstmc.protocol.bedrock.data.inventory.ItemData data, ItemMappings mappings)
     
    static com.github.steveice10.opennbt.tag.builtin.CompoundTag
    translateToJavaNBT(String name, org.cloudburstmc.nbt.NbtMap tag)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • translateToJava

      public static com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack translateToJava(org.cloudburstmc.protocol.bedrock.data.inventory.ItemData data, ItemMappings mappings)
      Parameters:
      mappings - item mappings to use while translating. This can't just be a Geyser session as this method is used when loading recipes.
    • translateToBedrock

      public static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder translateToBedrock(GeyserSession session, int javaId, int count, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
    • translateToBedrock

      public static @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData translateToBedrock(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack stack)
    • 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.
    • translateNbtToBedrock

      public static org.cloudburstmc.nbt.NbtMap translateNbtToBedrock(com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
    • translateToJavaNBT

      public static com.github.steveice10.opennbt.tag.builtin.CompoundTag translateToJavaNBT(String name, org.cloudburstmc.nbt.NbtMap tag)
    • translateDisplayProperties

      public static com.github.steveice10.opennbt.tag.builtin.CompoundTag translateDisplayProperties(GeyserSession session, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag, ItemMapping mapping)
      Translates the display name of the item
      Parameters:
      session - the Bedrock client's session
      tag - the tag to translate
      mapping - the item entry, in case it requires translation
      Returns:
      the new tag to use, should the current one be null
    • translateDisplayProperties

      public static com.github.steveice10.opennbt.tag.builtin.CompoundTag translateDisplayProperties(GeyserSession session, com.github.steveice10.opennbt.tag.builtin.CompoundTag tag, 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(com.github.steveice10.opennbt.tag.builtin.CompoundTag nbt, org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder builder, ItemMapping mapping)
      Translates the custom model data of an item