Package dan200.computercraft.api.turtle
Class TurtleToolBuilder
java.lang.Object
dan200.computercraft.api.turtle.TurtleToolBuilder
A builder for custom turtle tool upgrades.
This can be used from your data generator code in order to register turtle tools for your mod's tools.
Example
public static void addUpgrades(BootstrapContext<ITurtleUpgrade> upgrades) {
TurtleToolBuilder
.tool(ResourceLocation.fromNamespaceAndPath(ExampleMod.MOD_ID, "wooden_pickaxe"), Items.WOODEN_PICKAXE)
.register(upgrades);
}
-
Method Summary
Modifier and TypeMethodDescriptionadjective
(net.minecraft.network.chat.Component adjective) Specify a custom adjective for this tool.Indicate that this upgrade allows items which have been enchanted or have custom attribute modifiers.breakable
(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> breakable) Provide a list of breakable blocks.build()
Build the turtle tool upgrade.consumeDurability
(TurtleToolDurability durability) Set when the tool will consume durability.damageMultiplier
(float damageMultiplier) The amount of damage a swing of this tool will do.net.minecraft.resources.ResourceKey
<ITurtleUpgrade> id()
Get the id for this turtle tool.void
register
(net.minecraft.data.worldgen.BootstrapContext<ITurtleUpgrade> upgrades) Build this upgrade and register it for datagen.static TurtleToolBuilder
tool
(net.minecraft.resources.ResourceKey<ITurtleUpgrade> id, net.minecraft.world.item.Item item) static TurtleToolBuilder
tool
(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.Item item)
-
Method Details
-
tool
public static TurtleToolBuilder tool(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.Item item) -
tool
public static TurtleToolBuilder tool(net.minecraft.resources.ResourceKey<ITurtleUpgrade> id, net.minecraft.world.item.Item item) -
id
Get the id for this turtle tool.- Returns:
- The upgrade id.
-
adjective
Specify a custom adjective for this tool. By default this takes its adjective from the upgrade id.- Parameters:
adjective
- The new adjective to use.- Returns:
- The tool builder, for further use.
-
damageMultiplier
The amount of damage a swing of this tool will do. This is multiplied byAttributes.ATTACK_DAMAGE
to get the final damage.- Parameters:
damageMultiplier
- The damage multiplier.- Returns:
- The tool builder, for further use.
-
allowEnchantments
Indicate that this upgrade allows items which have been enchanted or have custom attribute modifiers.- Returns:
- The tool builder, for further use.
-
consumeDurability
Set when the tool will consume durability.- Parameters:
durability
- The durability predicate.- Returns:
- The tool builder, for further use.
-
breakable
public TurtleToolBuilder breakable(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> breakable) Provide a list of breakable blocks. If not given, the tool can break all blocks. If given, only blocks in this tag, those inComputerCraftTags.Blocks.TURTLE_ALWAYS_BREAKABLE
and "insta-mine" ones can be broken.- Parameters:
breakable
- The tag containing all blocks breakable by this item.- Returns:
- The tool builder, for further use.
- See Also:
-
build
Build the turtle tool upgrade.- Returns:
- The constructed upgrade.
-
register
Build this upgrade and register it for datagen.- Parameters:
upgrades
- The registry this upgrade should be added to.
-