Interface CustomItemDefinition.Builder
- All Superinterfaces:
GenericBuilder<CustomItemDefinition>
- All Known Subinterfaces:
NonVanillaCustomItemDefinition.Builder
- Enclosing interface:
CustomItemDefinition
The builder for the custom item definition.
- Since:
- 2.9.3
-
Method Summary
Modifier and TypeMethodDescriptionSets the Bedrock item options for this definition.build()Creates the custom item definition.default <T> CustomItemDefinition.Buildercomponent(ItemDataComponent<T> component, GenericBuilder<T> builder) Convenience method forcomponent(ItemDataComponent, Object)component(ItemDataComponent<T> component, T value) Sets data components that determine the item behavior.displayName(String displayName) Sets the display name, as shown to the Bedrock client.predicate(MinecraftPredicate<? super ItemPredicateContext> predicate) Adds a predicate that must match for Geyser to use this item definition.predicateStrategy(PredicateStrategy strategy) Sets the predicate strategy that should be used for item definition matching.priority(int priority) Sets the priority of this definition, used for definition matching.default CustomItemDefinition.BuilderremoveComponent(ItemDataComponent<?> component) Convenience method forremoveComponent(Identifier).removeComponent(Identifier component) Indicates a removed item component that will not be present on the custom item despite existing on the vanilla item.
-
Method Details
-
displayName
Sets the display name, as shown to the Bedrock client. When not set, the display name will be derived from the Bedrock item identifier.- Parameters:
displayName- the display name to show for Bedrock clients.- Returns:
- this builder
- Since:
- 2.9.3
-
priority
Sets the priority of this definition, used for definition matching.- Parameters:
priority- the priority- Returns:
- this builder
- Since:
- 2.9.3
- See Also:
-
bedrockOptions
Sets the Bedrock item options for this definition. Those determine the icon seen on Bedrock edition, whether the item can be placed in the offhand slot, and other options.- Parameters:
options- the bedrock item options- Returns:
- this builder
- Since:
- 2.9.3
- See Also:
-
predicate
Adds a predicate that must match for Geyser to use this item definition. SeeCustomItemDefinition.predicates()for details.- Parameters:
predicate- a predicate that must match for this item to be used- Returns:
- this builder
- Since:
- 2.9.3
-
predicateStrategy
Sets the predicate strategy that should be used for item definition matching.- Parameters:
strategy- the predicate strategy to use- Returns:
- this builder
- Since:
- 2.9.3
-
component
Sets data components that determine the item behavior. These are assumed to also be present server-side on the Java server. SeeCustomItemDefinition.components()for more information.Added data components cannot be removed using
removeComponent(Identifier), and this method will throw when a component is added that was removed using the aforementioned method.- Type Parameters:
T- the value held by the component- Parameters:
component- the type of the component, found inJavaItemDataComponentsvalue- the value of the component- Returns:
- this builder
- Throws:
IllegalArgumentException- when the added component was removed usingremoveComponent(Identifier)- Since:
- 2.9.3
-
component
default <T> CustomItemDefinition.Builder component(ItemDataComponent<T> component, GenericBuilder<T> builder) Convenience method forcomponent(ItemDataComponent, Object)- Type Parameters:
T- the value held by the component- Parameters:
component- the type of the component - found inJavaItemDataComponentsbuilder- the builder of the component- Returns:
- this builder
- Throws:
IllegalArgumentException- when the added component was removed usingremoveComponent(Identifier)- Since:
- 2.9.3
- See Also:
-
removeComponent
Indicates a removed item component that will not be present on the custom item despite existing on the vanilla item. This must match server-side behavior, otherwise, issues will occur. SeeCustomItemDefinition.removedComponents()for more information.Removed data components cannot be added again using
component(ItemDataComponent, Object), and this method will throw when a component is removed that was added using the aforementioned method.- Parameters:
component- the identifier of the vanilla base component to remove- Returns:
- this builder
- Throws:
IllegalArgumentException- when the removed component was added usingcomponent(ItemDataComponent, Object)- Since:
- 2.9.3
-
removeComponent
Convenience method forremoveComponent(Identifier).- Parameters:
component- the component type to remove- Returns:
- this builder
- Throws:
IllegalArgumentException- when the removed component was added usingcomponent(ItemDataComponent, Object)- Since:
- 2.9.3
-
build
CustomItemDefinition build()Creates the custom item definition.- Specified by:
buildin interfaceGenericBuilder<CustomItemDefinition>- Returns:
- the new custom item definition
- Since:
- 2.9.3
-