Interface NonVanillaCustomItemDefinition
- All Superinterfaces:
CustomItemDefinition
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for non-vanilla custom item definitions. -
Method Summary
Modifier and TypeMethodDescriptionbuilder(@NonNull Identifier javaIdentifier, int javaId) Creates a builder for a non-vanilla custom item definition, using thejavaIdentifierasbedrockIdentifier.builder(@NonNull Identifier javaIdentifier, @NonNull Identifier bedrockIdentifier, int javaId) Creates a new builder for a non-vanilla custom item definition.@NonNull ItemDataComponentMapOn top of vanilla Minecraft's item components, custom ones defined by Geyser inGeyserItemDataComponentscan also be used.@NonNull IdentifierThe item's Java identifier.@org.checkerframework.checker.index.qual.NonNegative intjavaId()The item's Java network ID.default @NonNull List<MinecraftPredicate<? super ItemPredicateContext>> Predicates are currently not supported for use with non-vanilla custom item definitions.default @NonNull PredicateStrategyPredicates are currently not supported for use with non-vanilla custom item definitions.default intpriority()Predicates are currently not supported for use with non-vanilla custom item definitions.@Nullable StringThe item's Java translation string.Methods inherited from interface org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition
bedrockIdentifier, bedrockOptions, displayName, icon, model, removedComponents
-
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
getIdmethod on the itemRegistry(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
Predicates are currently not supported for use with non-vanilla custom item definitions.Trying to use predicates will result in an error.
- Specified by:
predicatesin interfaceCustomItemDefinition- Throws:
UnsupportedOperationException- always, since predicate usage is not supported- Since:
- 2.9.3
-
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:
predicateStrategyin interfaceCustomItemDefinition- 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:
priorityin interfaceCustomItemDefinition- 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 inGeyserItemDataComponentscan 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:
componentsin interfaceCustomItemDefinition- 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 thejavaIdentifierasbedrockIdentifier.- Parameters:
javaIdentifier- the item's Java identifierjavaId- 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 identifierbedrockIdentifier- the item's bedrock identifierjavaId- the item's Java network ID- Returns:
- a new builder
- Since:
- 2.9.3
- See Also:
-