Interface NonVanillaCustomItemDefinition

All Superinterfaces:
CustomItemDefinition

@NonExtendable public interface NonVanillaCustomItemDefinition extends CustomItemDefinition
Defines a custom item introduced by mods and therefore not based on a vanilla item and its properties.

A definition will be used when an item is received with the ID of the definition. Predicate matching, as is possible right now with vanilla custom item definitions, is currently not implemented, so only one definition can be created for each Java non-vanilla item.

Non-vanilla item definitions can be configured with additional components defined in GeyserItemDataComponents.

Since:
2.9.3
  • Method Details

    • identifier

      @NonNull Identifier identifier()
      The item's Java identifier.
      Returns:
      the item's Java identifier
      Since:
      2.9.3
    • javaId

      @org.checkerframework.checker.index.qual.NonNegative int javaId()
      The item's Java network ID.

      In mods, you can get this by using the getId method on the item Registry (Mojmap): BuiltInRegistries.ITEM.getId(<item>)

      Returns:
      the item's Java network ID
      Since:
      2.9.3
    • translationString

      @Nullable String translationString()
      The item's Java translation string. When present, Geyser will translate this string using its loaded locales and send it to the bedrock client as the item's name.
      Returns:
      the item's Java translation string
      Since:
      2.9.3
    • predicates

      default @NonNull List<MinecraftPredicate<? super ItemPredicateContext>> predicates()
      Predicates are currently not supported for use with non-vanilla custom item definitions.

      Trying to use predicates will result in an error.

      Specified by:
      predicates in interface CustomItemDefinition
      Throws:
      UnsupportedOperationException - always, since predicate usage is not supported
      Since:
      2.9.3
    • predicateStrategy

      default @NonNull PredicateStrategy predicateStrategy()
      Predicates are currently not supported for use with non-vanilla custom item definitions.

      Trying to use predicates will result in an error.

      Specified by:
      predicateStrategy in interface CustomItemDefinition
      Throws:
      UnsupportedOperationException - always, since predicate usage is not supported
      Since:
      2.9.3
    • priority

      default int priority()
      Predicates are currently not supported for use with non-vanilla custom item definitions.

      Trying to use predicates will result in an error.

      Specified by:
      priority in interface CustomItemDefinition
      Returns:
      the priority of this definition. For all definitions for a single Java item model, definitions with a higher priority will be matched first. Defaults to 0.
      Throws:
      UnsupportedOperationException - always, since predicate usage is not supported
      Since:
      2.9.3
    • components

      @NonNull ItemDataComponentMap components()
      On top of vanilla Minecraft's item components, custom ones defined by Geyser in GeyserItemDataComponents can also be used. Like with vanilla data components, it is still expected that the item always has the behavior defined by its components.

      Default component removals are not supported for non-vanilla items, since here the data component map defines default components, instead of a patch on top of a vanilla base item.

      Specified by:
      components in interface CustomItemDefinition
      Returns:
      the item's default data components
      Since:
      2.9.3
      See Also:
    • builder

      static NonVanillaCustomItemDefinition.Builder builder(@NonNull Identifier javaIdentifier, int javaId)
      Creates a builder for a non-vanilla custom item definition, using the javaIdentifier as bedrockIdentifier.
      Parameters:
      javaIdentifier - the item's Java identifier
      javaId - the item's Java network ID
      Returns:
      a new builder
      Since:
      2.9.3
      See Also:
    • builder

      static NonVanillaCustomItemDefinition.Builder builder(@NonNull Identifier javaIdentifier, @NonNull Identifier bedrockIdentifier, int javaId)
      Creates a new builder for a non-vanilla custom item definition.
      Parameters:
      javaIdentifier - the item's Java identifier
      bedrockIdentifier - the item's bedrock identifier
      javaId - the item's Java network ID
      Returns:
      a new builder
      Since:
      2.9.3
      See Also: