Aug. 13th, 2021

dragoness_e: (Raditz)
Ganked from changelog:

Build: 1.17.1-37.0.31 - Tue Aug 10 22:45:23 GMT 2021
gigaherz:
Redesign the tool system to rely on the new vanilla tags. (#7970)

Changed:
- ToolType is replaced with ToolAction, which can selectively represent which actions are supported by an item.
- Added a canPerformAction method to query ToolActions.
- Renamed canHarvestBlock to isCorrectToolForDrops to match vanilla.
- Added TierSortingRegistry, which can be used to add custom tiers and supports sorting between vanilla or with other mods.

How to use:

For the breaking system there's 2 methods:
- getDestroySpeed decides if an item *can* mine the block fast. Override if you have multiple tags or your item isn't a DiggerItem.
- isCorrectToolForDrops decides if an item will get drops. Returning false will also slow down mining, regardless of getDestroySpeed. Override if you have type-dependant tiers or your item isn't a DiggerItem.

For the tier system mods can just call `TierSortingRegistry.registerTier(tier, "name", List.of(lesser tiers), List.of(better tiers));` to register their tiers.
There's helper methods to query tiers such as TierSortingRegsitry.isCorrectTierForDrops.

The ToolActions solve 2 problems:
1. distinguishing which kind of digger an item can be
2. querying if the item can perform specific secondary actions.
Any item can override `canPerformAction` to customize which actions it performs.

Additional notes from Gigahertz on updating tools:

Remove the harvestTool and harvestLevel calls from the blocks
and instead, add the block to the relevant tags
ToolType.AXE -> minecraft:mineable/axe
ToolType.PICKAXE -> minecraft:mineable/pickaxe
ToolType.SHOVEL -> minecraft:mineable/shovel
and so on


  • harvest level 0 -> forge:needs_wood_tool
  • was harvest level 0 but you want only GOLD tools to mine, not wood -> forge:needs_gold_tool
  • harvest level 1 -> minecraft:needs_stone_tool
  • harvest level 2 -> minecraft:needs_iron_tool
  • harvest level 3 -> minecraft:needs_diamond_tool
  • harvest level 4 -> forge:needs_netherite_tool


if you define a custom tool type, define a custom tool type tag, can be optional if you don't have any default blocks
if you define a custom tier, register it into the TierSortingRegistry
if your tier is supposed to be equivalent to a vanilla tier, specify the tier you want to be equivalent to in the "after" list, the tier right after that in the "before" list, and have an empty optional tag in your tier.
you can use ForgeTier as a convenience
dragoness_e: (Sinhika)

An update to my original Minecraft Modding post, focusing on 1.13/1/14 modding and later. Refer to the older post for older versions of Minecraft. The old one got a bit unwieldy for updates.

Not all modding tutorials are useful. Some are outdated, and some were written by people with a shaky grasp on Java, how Minecraft works internally, the MinecraftForge source, or all three. A lot of them are uninformative, because the authors start at the beginning and never get to advanced topics, so you have a lot of tutorials on how to make a basic block, but very few (if any) on how to add new crops or render entities or add new crafting interfaces.

Read more... )

Profile

dragoness_e: (Default)
Dragoness Eclectic

May 2025

S M T W T F S
     123
45678910
11121314151617
18192021222324
25262728293031

Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 7th, 2025 03:33 pm
Powered by Dreamwidth Studios