Class ItemTranslator

java.lang.Object
org.geysermc.connector.network.translators.item.ItemTranslator
Direct Known Subclasses:
BannerTranslator, CompassTranslator, PotionTranslator, TippedArrowTranslator

public abstract class ItemTranslator extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack itemStack, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack equalsItemStack, boolean checkAmount, boolean trueIfAmountIsGreater, boolean checkNbt)
    Checks if an ItemStack is equal to another item stack
    abstract List<ItemMapping>
     
    static void
     
    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)
     
    com.nukkitx.nbt.NbtMap
    translateNbtToBedrock​(com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
     
    com.nukkitx.protocol.bedrock.data.inventory.ItemData.Builder
    translateToBedrock​(com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack itemStack, ItemMapping mapping, ItemMappings mappings)
     
    static com.nukkitx.protocol.bedrock.data.inventory.ItemData
    translateToBedrock​(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack stack)
     
    com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack
    translateToJava​(com.nukkitx.protocol.bedrock.data.inventory.ItemData itemData, ItemMapping mapping, ItemMappings mappings)
     
    static com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack
    translateToJava​(com.nukkitx.protocol.bedrock.data.inventory.ItemData data, ItemMappings mappings)
     
    com.github.steveice10.opennbt.tag.builtin.CompoundTag
    translateToJavaNBT​(String name, com.nukkitx.nbt.NbtMap tag)
     

    Methods inherited from class java.lang.Object

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

    • ItemTranslator

      protected ItemTranslator()
  • Method Details

    • init

      public static void init()
    • translateToJava

      public static com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack translateToJava(com.nukkitx.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

      @Nonnull public static com.nukkitx.protocol.bedrock.data.inventory.ItemData translateToBedrock(GeyserSession session, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack stack)
    • translateToBedrock

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData.Builder translateToBedrock(com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack itemStack, ItemMapping mapping, ItemMappings mappings)
    • translateToJava

      public com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack translateToJava(com.nukkitx.protocol.bedrock.data.inventory.ItemData itemData, ItemMapping mapping, ItemMappings mappings)
    • getAppliedItems

      public abstract List<ItemMapping> getAppliedItems()
    • translateNbtToBedrock

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

      public com.github.steveice10.opennbt.tag.builtin.CompoundTag translateToJavaNBT(String name, com.nukkitx.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.
    • equals

      public boolean equals(com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack itemStack, com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack equalsItemStack, boolean checkAmount, boolean trueIfAmountIsGreater, boolean checkNbt)
      Checks if an ItemStack is equal to another item stack
      Parameters:
      itemStack - the item stack to check
      equalsItemStack - the item stack to check if equal to
      checkAmount - if the amount should be taken into account
      trueIfAmountIsGreater - if this should return true if the amount of the first item stack is greater than that of the second
      checkNbt - if NBT data should be checked
      Returns:
      if an item stack is equal to another item stack