Interface Limitations


public interface Limitations
Version-dependent limitations.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    bannerPatternExists(net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.BannerPattern> pattern, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
     
    boolean
    effectExists(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
     
    boolean
    enchantmentExists(net.minecraft.resources.ResourceKey<net.minecraft.world.item.enchantment.Enchantment> enchantment, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
     
    int
    getStackCount(net.minecraft.world.item.ItemStack stack)
    Similar to ItemStack.getCount(), but also handles negative item counts in pre 1.11 versions
    boolean
    itemExists(net.minecraft.world.item.Item item, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
     
    boolean
    itemExistsInConnection(net.minecraft.world.item.Item item)
    Similar to itemExists(net.minecraft.world.item.Item, ProtocolVersion), but takes in the current connection details (e.g., classic protocol extensions being loaded)
    boolean
    itemExistsInConnection(net.minecraft.world.item.ItemStack stack)
    default int
    Calculates the maximum chat length for the current target version.
    int
    maxChatLength(com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
    Calculates the maximum chat length for given ProtocolVersion instance.
  • Method Details

    • maxChatLength

      default int maxChatLength()
      Calculates the maximum chat length for the current target version.
      Returns:
      The maximum chat length
    • maxChatLength

      int maxChatLength(com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
      Calculates the maximum chat length for given ProtocolVersion instance.
      Returns:
      The maximum chat length
    • itemExists

      boolean itemExists(net.minecraft.world.item.Item item, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
      Parameters:
      item - The item to check
      version - The version to check for
      Returns:
      true if the item exists in the given version, false otherwise; this will also check for CPE items (CustomBlocks V1 extension)
    • enchantmentExists

      boolean enchantmentExists(net.minecraft.resources.ResourceKey<net.minecraft.world.item.enchantment.Enchantment> enchantment, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
      Parameters:
      enchantment - The enchantment to check
      version - The version to check for
      Returns:
      true if the enchantment exists in the given version, false otherwise
    • effectExists

      boolean effectExists(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
      Parameters:
      effect - The status effect to check
      version - The version to check for
      Returns:
      true if the status effect exists in the given version, false otherwise
    • bannerPatternExists

      boolean bannerPatternExists(net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.BannerPattern> pattern, com.viaversion.viaversion.api.protocol.version.ProtocolVersion version)
      Parameters:
      pattern - The banner pattern to check
      version - The version to check for
      Returns:
      true if the banner pattern exists in the given version, false otherwise
    • itemExistsInConnection

      boolean itemExistsInConnection(net.minecraft.world.item.Item item)
      Similar to itemExists(net.minecraft.world.item.Item, ProtocolVersion), but takes in the current connection details (e.g., classic protocol extensions being loaded)
      Parameters:
      item - The item to check
      Returns:
      true if the item exists in the current connection, false otherwise
    • itemExistsInConnection

      boolean itemExistsInConnection(net.minecraft.world.item.ItemStack stack)
      Same as itemExists(net.minecraft.world.item.Item, ProtocolVersion), but for item stacks. This also compares against certain data components like enchantments or banner patterns.
      Parameters:
      stack - The item stack to check
      Returns:
      true if the item stack exists in the given version, false otherwise
    • getStackCount

      int getStackCount(net.minecraft.world.item.ItemStack stack)
      Similar to ItemStack.getCount(), but also handles negative item counts in pre 1.11 versions
      Parameters:
      stack - The item stack to get the count of
      Returns:
      the count of the item stack can be negative in pre 1.11 versions