fix: add valid pickaxes to incorrect_for_wooden_tool material map (wrong dig times) - #1232
Open
AnonymoDGH wants to merge 1 commit into
Open
Conversation
The incorrect_for_wooden_tool material map only listed the wooden tools (the incorrect ones), so valid pickaxes (stone/iron/diamond/netherite, plus copper on 1.21.9+) fell back to a mining speed of 1 in prismarine-block digTime. This made iron_ore take ~4550ms with an iron pickaxe instead of the correct ~750ms (mineflayer issue PrismarineJS/mineflayer#3921). Add the non-wooden pickaxes from mineable/pickaxe into incorrect_for_wooden_tool at their correct speeds, preserving the existing wooden-tool entries (including the 1.21.4 wooden=1.0 values from PrismarineJS#1033). Verified end-to-end via prismarine-block digTime on 1.21.1 and 1.21.11.
Contributor
Author
|
Note on CI: the Node 22 The |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reported in PrismarineJS/mineflayer#3921: on 1.21.11,
block.digTime()returns wildly wrong values for blocks whose material isincorrect_for_wooden_tool(iron ore, copper ore, obsidian, ancient debris, raw metal blocks, etc.) when holding a valid pickaxe.Reproduction with prismarine-block + minecraft-data 3.113.2 (1.21.1, iron_ore, hardness 3):
Root cause
prismarine-block'sdigTimelooks the held item up inregistry.materials[block.material]. Theincorrect_for_wooden_toolmap only contains the four wooden tools (the incorrect ones), so every valid pickaxe misses the lookup and silently falls back to a block-breaking speed of 1 instead of its real speed (stone 4, iron 6, diamond 8, netherite 9).Fix
For every version that has this material (1.20.5, 1.21.1, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.8, 1.21.9, 1.21.11, 26.1), add the non-wooden pickaxes from
mineable/pickaxeintoincorrect_for_wooden_toolat their correct speeds. The existing wooden-tool entries are preserved untouched (including the 1.21.4wooden=1.0values introduced by #1033). On 1.21.9+ this also addscopper_pickaxeat speed 1, matching itsmineable/pickaxeentry.Example (1.21.11):
"incorrect_for_wooden_tool": { "912": 2.0, "913": 2.0, "914": 2.0, - "915": 2.0 + "915": 2.0, + "918": 1.0, + "923": 4.0, + "928": 12.0, + "933": 6.0, + "938": 8.0, + "943": 9.0 },Verification
Schema: all 10 changed files pass
materials_schema.jsonvalidation (ajv).End-to-end via prismarine-block
digTimeafter this change (1.21.1 and 1.21.11, iron_ore):canHarvest(drop gating viaharvestTools) is unaffected; this only corrects the mining speed lookup.Fixes PrismarineJS/mineflayer#3921 (data side).