Interface JavaTool
public interface JavaTool
The tool component can be used to mark if the item can destroy blocks when used in creative mode.
For non-vanilla items, it is also important to set a default mining speed
and all the rules the tool has to ensure proper block breaking.
For vanilla-item overrides, Geyser is able to handle this automatically.
- Since:
- 2.9.3
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for the tool component.static interfaceA rule for a tool. -
Method Summary
Modifier and TypeMethodDescriptionstatic JavaTool.Builderbuilder()Creates a builder for the tool component.booleanWhether this item can destroy blocks when trying to break them in creative mode.@org.checkerframework.checker.index.qual.Positive floatThe default mining speed of the tool.static JavaToolof(boolean canDestroyBlocksInCreative) Creates a tool component, without any rules or a default mining speed.rules()A list of rules this tool has.
-
Method Details
-
rules
List<JavaTool.Rule> rules()A list of rules this tool has. A tool rule consists of aHoldersof block identifiers, and the break speed for those blocks. Doesn't have to be set for vanilla-item overrides.- Returns:
- a list of rules this tool has
- Since:
- 2.9.3
-
defaultMiningSpeed
@org.checkerframework.checker.index.qual.Positive float defaultMiningSpeed()The default mining speed of the tool. This speed is used when no rules match when breaking a block. Defaults to 0.0, and doesn't have to be set for vanilla-item overrides.- Returns:
- the default mining speed of the tool
- Since:
- 2.9.3
-
canDestroyBlocksInCreative
boolean canDestroyBlocksInCreative()Whether this item can destroy blocks when trying to break them in creative mode. Defaults totrue.- Returns:
- whether this item can destroy blocks in creative mode
- Since:
- 2.9.3
-
builder
Creates a builder for the tool component.- Returns:
- a new builder
- Since:
- 2.9.3
-
of
Creates a tool component, without any rules or a default mining speed. This should only be used for vanilla-item overrides.- Parameters:
canDestroyBlocksInCreative- determines if the item will break blocks in creative mode- Returns:
- a tool component
- Since:
- 2.9.3
-