pc: Fix slow break time for harvest-restricted blocks (1.20.5-1.21.11)#1193
Conversation
Across 1.20.5-1.21.11, blocks like diamond_ore, iron_ore, obsidian, ancient_debris, netherite_block, and the copper family carry material "incorrect_for_wooden_tool" but have a populated harvestTools entry. The materials table for that key only contains the wooden tool ids (912-915), so a higher-tier tool lookup (e.g. netherite_pickaxe = 943) misses, speed defaults to 1.0, and digTime returns ~4550 ms where vanilla expects ~500 ms. Switching the material to "mineable/pickaxe" routes the lookup to the populated tier table (913, 918, 923, 928, 933, 938, 943 -> 2, 1, 4, 12, 6, 8, 9). harvestTools is untouched, so canHarvest still enforces the iron+/stone+ gate exactly as before. Affects 842 entries across 9 version directories. Refs: PrismarineJS#987, PrismarineJS#412, prismarine-block#22
|
You would need to update the data generator for this, as all that data is automatically generated. It would be outdated every version. The better fix is to properly implement the tag system PrismarineJS/minecraft-data-generator#56 is adding that on the data gen side, data for that is in #1080 |
Makes sense — thanks for the pointer. I hit this while patching Cairn locally and opened this mainly to make the repro/failure mode visible, not to push a generated-data edit as the long-term fix. I agree the durable fix belongs in the generator/tag path. I’ll leave this as repro context and won’t push this data-level approach further. |
Summary
Blocks with
"material": "incorrect_for_wooden_tool"and populatedharvestToolsreport adigTimeroughly 9× too slow when broken with a tool that can actually harvest them.For
diamond_orewith a netherite pickaxe (item id 943):materials["incorrect_for_wooden_tool"]only contains the wooden tool ids (912–915), so the lookup misses, speed defaults to1.0, and digTime returnsceil(1 / (1.0/3.0/30.0)) * 50 = 4550 ms. Vanilla expects ~500 ms. The block is breakable —canHarvestreadsharvestTools, which is correct — it just takes 9× longer than vanilla.Fix
Where
material === "incorrect_for_wooden_tool"andharvestToolsis non-empty, switch the material to"mineable/pickaxe". That table is already populated for every pickaxe tier (913, 918, 923, 928, 933, 938, 943 → 2, 1, 4, 12, 6, 8, 9).harvestToolsis untouched, socanHarveststill enforces the tier gate.craftermatches the material but has noharvestTools, so it's not touched here.Verification
Repro with
prismarine-block+minecraft-data, vs. values from the Breaking page on the Minecraft Wiki:Wrong-tool penalties (e.g. wooden pickaxe on diamond_ore) and bare-hand times are unchanged.
Scope
842 line changes across 9 version directories. Every changed line is exactly:
Refs
Checklist
audit_blocksparity check passes