Tinkers' Construct Documentation
repository·1.20.1·Indexed 23 days ago
https://github.com/slimeknights/tinkersconstructA Minecraft mod focused on metal melting and tool customization. This documentation covers workspace setup and compilation from source, as well as technical details for implementing custom commands using arguments for materials, modifiers, tool statistics, and slot types. It also includes references for administrative subcommands such as durability modification and automated recipe/tag generation.
What's inside Tinkers' Construct
- For technical documentation regarding writing addons or working with Tinkers' Construct datapacks, visit the official SlimeKnight's documentation site: https://slimeknights.github.io/docs/
Report an issue with Tinkers' Construct
1.20.1When reporting an issue, please provide the following information to ensure it can be addressed:
- Minecraft version
- Tinkers' Construct version
- Forge version/build
- Versions of any mods potentially related to the issue
- Relevant screenshots
For crashes, you must also include:
- Steps to reproduce the crash
- The
latest.log(FML log) located in the root folder of your client
Set up a workspace and compile Tinkers' Construct from source
1.20.1To develop on or compile Tinkers' Construct, ensure Git is installed and available in your system path. Follow these steps:
- Setup: Import the Tinkers' Construct repository as a Gradle project into IntelliJ IDEA and allow it to run the initial setup.
- Generate Runs: Run the command
gradlew genIntellijRunswithin IntelliJ IDEA to configure execution environments. - Build: Run
gradlew buildto compile the project.
If you encounter obscure Gradle issues, attempt to clear the state by running:
gradlew cleangradlew cleanCache
Configure melting recipe generation
1.20.1The generation process is controlled by a JSON configuration file located at
command/generate_melting_recipes.jsonwithin your datapacks. This file allows you to define which items are eligible to be melted, which items can serve as inputs, and which items should be ignored or which recipes should be skipped.Supported configuration keys:
melt: AnIJsonPredicate<Item>defining which items are eligible to receive a melting recipe (the result of the crafting recipe).inputs: AnIJsonPredicate<Item>defining which items are valid ingredients for the melting process.ignore: AnIJsonPredicate<Item>defining items that can be present in a recipe but do not contribute to the fluid output (effectively ignored).skip_recipes: A list ofResourceLocations representing specific crafting recipes to skip during the generation process.
Use SlotTypeArgument in commands
1.20.1When developing custom commands for Tinkers' Construct, you can use
SlotTypeArgumentto allow users to select a specific modifier slot type. This argument supports providing a validSlotTypename or, if configured, a specialslotlesskeyword.Argument Behavior
- Valid Slot Types: Users can input the name of an existing
SlotType(e.g.,upgrades,abilities). - Slotless Option: If the argument is initialized with
allowSlotless = true, users can inputslotlessto represent a null/empty slot type. - Suggestions: The command will automatically provide suggestions based on all available
SlotTypenames, plusslotlessif enabled.
Retrieving Values from Command Context
Depending on whether you want to allow a null value or require a specific type, use the following methods:
getOptional(context, name): Returns anOptionalSlotTyperecord. Use this if you want to handle the case where the user selectsslotless(which results in anullslot type inside the record).getSlotType(context, name): Returns a non-nullSlotType. This method will throw aCommandSyntaxExceptionif the user providesslotlessor an invalid type.
- Valid Slot Types: Users can input the name of an existing
Use ModifierTagSource for command arguments
1.20.1In Tinkers' Construct command development,
ModifierTagSourceis used to provide a source for Minecraft command arguments that need to selectModifierobjects via tags or resource locations. It integrates with theModifierManagerto resolve tags and individual modifier entries.When implementing custom commands that require selecting modifiers, use this source to allow users to input either a specific modifier ID (as a
ResourceLocation) or a tag containing modifiers.Use MaterialStatsArgument in commands
1.20.1The
MaterialStatsArgumentis a custom Brigadier argument type used in Tinkers' Construct commands to select specific material statistics (e.g.,tconstruct:headortconstruct:limb).When implementing or using commands that require a material stat type, this argument parses a resource location ID and returns the corresponding
MaterialStatType<?>. If the provided ID does not match a registered stat type, it throws amaterial_stat.not_founderror.Usage in Command Implementation: To retrieve the parsed stat type from a command context, use the
getStathelper method, providing the context and the name of the argument as defined in your command tree.Use ToolStatArgument in commands
1.20.1When developing custom commands for Tinkers' Construct, you can use
ToolStatArgumentto allow users to select a specific tool statistic (e.g., mining speed or durability) via the CLI.- The argument expects a resource identifier in the format
namespace:path(e.g.,tconstruct:mining_speed). - You can provide a
filterclass to restrict the available statistics to a specific subtype ofIToolStat. - To retrieve the parsed statistic from a command context, use the
getStathelper method.
Examples of valid input:
tconstruct:mining_speedtconstruct:durability
- The argument expects a resource identifier in the format
Use the Material argument in commands
1.20.1When interacting with Tinkers' Construct commands via the Minecraft CLI, you can specify materials using a resource identifier format. The argument accepts valid
IMaterialidentifiers registered within the mod.Format:
modid:material_name(e.g.,tconstruct:iron)Examples:
tconstruct:woodtconstruct:iron
tconstruct:wood tconstruct:ironUse MaterialTagSource for command arguments
1.20.1In Tinkers' Construct command development,
MaterialTagSourceis used to allow users to select materials or material tags via CLI arguments. It bridges theMaterialManagerwith theTagSourceinterface, enabling commands to resolveIMaterialobjects from Minecraft tags or specificResourceLocationidentifiers.When implementing a command that requires material selection, using this source allows the command to:
- Validate if a provided tag exists in the
MaterialManager. - Resolve a
ResourceLocation(e.g.,tconstruct:cobalt) into anIMaterialinstance. - List all available material tags and individual material keys for tab completion.
- Validate if a provided tag exists in the
Use the modifier hook argument in commands
1.20.1When developing or using commands within Tinkers' Construct, you can use the
ModifierHookArgumentto allow users to select a specificModuleHook<?>. This argument expects aResourceLocation(namespaced ID) that corresponds to a registered modifier hook.Usage Details:
- Input Format: A namespaced string (e.g.,
tconstruct:tool_stats). - Validation: The argument validates that the provided ID exists within the
ModifierHooksregistry. If the ID is not found, it throws amodifier_hook.not_founderror. - Suggestions: The command interface will provide autocomplete suggestions based on the keys currently loaded in
ModifierHooks.LOADER.
Examples of valid inputs:
tconstruct:tool_statstconstruct:tooltip
- Input Format: A namespaced string (e.g.,
Use MaterialVariantArgument in commands
1.20.1TheMaterialVariantArgumentis a command argument type used to select specific material variants within Tinkers' Construct commands. It expects a resource identifier formatted as aMaterialVariantId. When used in a command, it provides auto-completion suggestions for all registered materials in theMaterialRegistryand displays their colored display names via theMaterialTooltipCache.