Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Tags
Creators
Details
The Legacy Tool API is a library mod for Legacy Fabric that adds an API compatibility layer for custom tools (sword, pickaxe, axe, shovel, hoe are all supported) as well as custom, extensible tool materials (the API layer does not use the vanilla tool material system- it has its own "ModToolMaterial", which is a regular class instead of an enum therefore can be extended easily).
It also includes a Mixin patch that adds the item forms of technical blocks (item forms which were removed in 13w37a- but this mod undoes that removal in order to stabilize Legacy Fabric's otherwise unstable registry remapping). This means that item forms of blocks like piston extension (ID 36) or lit redstone lamp (ID 124) etc. are now obtainable again- however, the actual purpose of that patch is to avoid broken block-item IDs (e.g., a block with ID 500 ending up having an item form with ID 26- which this mod prevents by filling ID 26 and other "empty" item IDs with the actual bed block item).
The important classes of Legacy Tool API are:
IEffective- used for effective-block setting (intended as an improvement over the "EFFECTIVE_BLOCKS" fields in vanilla tools)
IHarvestLevel- used for setting harvest level for blocks (intended to emulate Forge's harvest-level system).
ModToolMaterial- the custom tool material system (providing a vanilla-style base form which can be extended if desired).
ModTool- the base class for custom pickaxes/axes/shovels (using ModToolMaterial instead of the vanilla tool material system; extensible if desired)
ModSword, ModPickaxe, ModAxe, ModShovel, ModHoe- the classes for custom tools ("ModSword" and "ModHoe" extend "Item" while "ModPickaxe", "ModAxe", and "ModShovel" extend "ModTool"- and each uses ModToolMaterial instead of the vanilla tool materials)
BaseModBlock- showing the intended implementations of IHarvestLevel and IEffective
PickaxeEffectiveBlock, AxeEffectiveBlock, ShovelEffectiveBlock- extensions of BaseModBlocks, providing examples to using IEffective and IHarvestLevel
ItemMixin- the aforementioned Mixin item patch
Unlike Forge's tool system, the Legacy Tool API has no "EnumHelper" and doesn't directly modify the vanilla tool system. Instead of that, it has its own tool-material system (ModToolMaterial), tool classes (ModSword, ModTool etc.), and interfaces (IHarvestLevel, IEffective).
Instead of doing something like:
"EnumHelper.addToolMaterial(...)"
You are supposed to do this with Legacy Tool API:
"public static final ModToolMaterial material = new ModToolMaterial(...)"
Then use the material in the items you register. No separate registry for tool materials is required.
The mod itself provides example implementations (the "test" tools, the "effective" blocks) for reference.
The mod requires Legacy Fabric API 1.13.5 and Minecraft 1.7.10.


