接口 ToolComponent
- 所有超级接口:
ConfigurationSerializable
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明addRule(@NotNull Collection<Material> blocks, @Nullable Float speed, @Nullable Boolean correctForDrops) 向此工具组件添加新规则,提供关于一组方块类型的进一步信息。向此工具组件添加新规则,提供关于特定方块类型的进一步信息。向此工具组件添加新规则,提供关于由方块Tag表示的一组方块类型的进一步信息。boolean获取此工具是否可以在创造模式下破坏方块。int获取每次破坏方块时从工具中移除的耐久度。float获取此工具的默认挖掘速度。getRules()获取适用于此工具的ToolRules列表。boolean从此工具中移除给定的ToolComponent.ToolRule。voidsetCanDestroyBlocksInCreative(boolean destroy) 设置此工具是否可以在创造模式下破坏方块。voidsetDamagePerBlock(int damage) 设置每次破坏方块时从工具中移除的耐久度。voidsetDefaultMiningSpeed(float speed) 设置此工具的默认挖掘速度。voidsetRules(@NotNull List<ToolComponent.ToolRule> rules) 设置适用于此工具的ToolRules列表。从接口继承的方法 org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
方法详细资料
-
getDefaultMiningSpeed
float getDefaultMiningSpeed()获取此工具的默认挖掘速度。如果没有规则明确覆盖此值,则工具使用此值。1.0为标准挖掘速度。原文:Get the default mining speed of this tool. This value is used by the tool if no rule explicitly overrides it. 1.0 is standard mining speed.
- 返回:
- 默认挖掘速度
- 另请参阅:
-
setDefaultMiningSpeed
void setDefaultMiningSpeed(float speed) 设置此工具的默认挖掘速度。如果没有规则明确覆盖此值,则工具使用此值。1.0为标准挖掘速度。原文:Set the default mining speed of this tool. This value is used by the tool if no rule explicitly overrides it. 1.0 is standard mining speed.
- 参数:
speed- 要设置的速度
-
getDamagePerBlock
int getDamagePerBlock()获取每次破坏方块时从工具中移除的耐久度。原文:Get the amount of durability to be removed from the tool each time a block is broken.
- 返回:
- 每个方块的伤害值
-
setDamagePerBlock
void setDamagePerBlock(int damage) 设置每次破坏方块时从工具中移除的耐久度。原文:Set the amount of durability to be removed from the tool each time a block is broken.
- 参数:
damage- 要设置的伤害值。必须为0或正整数
-
canDestroyBlocksInCreative
boolean canDestroyBlocksInCreative()获取此工具是否可以在创造模式下破坏方块。原文:Get whether this tool can destroy blocks in creative.
- 返回:
- 是否可以破坏
-
setCanDestroyBlocksInCreative
void setCanDestroyBlocksInCreative(boolean destroy) 设置此工具是否可以在创造模式下破坏方块。原文:Set whether this tool can destroy blocks in creative.
- 参数:
destroy- 是否可以破坏
-
getRules
- 返回:
- 所有工具规则。返回列表的可变性无法保证,但其内容是可变的,可以更改其值
-
setRules
设置适用于此工具的ToolRules列表。这将移除所有现有的工具规则。原文:Set the list of
ToolRulesto apply to this tool. This will remove any existing tool rules.- 参数:
rules- 要设置的规则
-
addRule
@NotNull @NotNull ToolComponent.ToolRule addRule(@NotNull @NotNull Material block, @Nullable @Nullable Float speed, @Nullable @Nullable Boolean correctForDrops) 向此工具组件添加新规则,提供关于特定方块类型的进一步信息。原文:Add a new rule to this tool component, which provides further information about a specific block type.
- 参数:
block- 规则适用的方块类型speed- 挖掘该方块时使用的挖掘速度,或null使用默认挖掘速度correctForDrops- 此工具在挖掘该方块时是否被视为该方块的最佳工具,并在破坏时掉落物品,或null使用Minecraft定义的默认工具检查行为- 返回:
- 添加到此工具的
ToolComponent.ToolRule实例
-
addRule
@NotNull @NotNull ToolComponent.ToolRule addRule(@NotNull @NotNull Collection<Material> blocks, @Nullable @Nullable Float speed, @Nullable @Nullable Boolean correctForDrops) 向此工具组件添加新规则,提供关于一组方块类型的进一步信息。原文:Add a new rule to this tool component, which provides further information about a collection of block types.
- 参数:
blocks- 规则适用的方块类型speed- 挖掘其中一个方块时使用的挖掘速度,或null使用默认挖掘速度correctForDrops- 此工具在挖掘其中一个方块时是否被视为该方块的最佳工具,并在破坏时掉落物品,或null使用Minecraft定义的默认工具检查行为- 返回:
- 添加到此工具的
ToolComponent.ToolRule实例
-
addRule
@NotNull @NotNull ToolComponent.ToolRule addRule(@NotNull @NotNull Tag<Material> tag, @Nullable @Nullable Float speed, @Nullable @Nullable Boolean correctForDrops) 向此工具组件添加新规则,提供关于由方块Tag表示的一组方块类型的进一步信息。原文:Add a new rule to this tool component, which provides further information about a collection of block types represented by a block
Tag.- 参数:
tag- 包含规则适用方块类型的方块标签speed- 挖掘其中一个方块时使用的挖掘速度,或null使用默认挖掘速度correctForDrops- 此工具在挖掘其中一个方块时是否被视为该方块的最佳工具,并在破坏时掉落物品,或null使用Minecraft定义的默认工具检查行为- 返回:
- 添加到此工具的
ToolComponent.ToolRule实例 - 抛出:
IllegalArgumentException- 如果传入的tag不是方块标签
-
removeRule
从此工具中移除给定的ToolComponent.ToolRule。原文:Remove the given
ToolComponent.ToolRulefrom this tool.- 参数:
rule- 要移除的规则- 返回:
- 如果规则被移除则返回true,如果此组件不包含匹配的规则则返回false
-