Skip to content

Keep the shears speed special cases when walking tool components (1.21.5+) - #88

Open
Pix3lPirat3 wants to merge 2 commits into
PrismarineJS:mainfrom
Pix3lPirat3:fix/shears-speed
Open

Pix3lPirat3 wants to merge 2 commits into
PrismarineJS:mainfrom
Pix3lPirat3:fix/shears-speed

Conversation

@Pix3lPirat3

Copy link
Copy Markdown

MaterialsDataGenerator.generateDataJson() seeds the vanilla ShearsItem speeds first (leaves 15, coweb 15, wool 5, vine_or_glow_lichen 2), then walks every item's tool component and does materialSpeeds.put(item, getToolSpeed(item)) per rule tag. From 1.21.5 the shears tool component carries overrideSpeed rules on the leaves and wool tags, so that walk overwrites the seeded 15 and 5 with the name-derived default 1.0. Cobweb and vine/glow_lichen use direct block sets rather than tags, which is why only leaves and wool are wrong. Shipped materials.json has shears at 1.0 on leaves and wool for 1.21.5–26.1; 1.21.3 and earlier are correct, and regenerating them with current code still gives 15/5.

putIfAbsent in the loop keeps the seeded entries; nothing else changes - regenerating the eight modules alters exactly four entries per version (the three leaves* tables and wool, shears only). Live on vanilla 26.1 with mineflayer 4.39.0, wool with shears goes from a 1211 ms dig to 251 ms (vanilla 250); leaves become instant as in vanilla.

Stacked on #87.

getToolSpeed() maps speed from the item-name prefix and had no entry for copper, so every copper tool fell to the 1.0 default in materials.json. Vanilla ToolMaterial.COPPER is 5.0. Add it for the modules that have copper tools: 1.21.9, 1.21.10, 1.21.11 and 26.1.
…1.5+)

generateDataJson() seeds the shears speeds (leaves 15, wool 5) and then walks every item's tool component, putting the name-derived default speed for each rule tag. From 1.21.5 the shears component has rules on the leaves and wool tags, so the walk overwrote the seeded values with 1.0. Use putIfAbsent so seeded entries survive.
extremeheat pushed a commit to PrismarineJS/minecraft-data that referenced this pull request Sep 18, 2026
* pc: fix copper tool speeds in materials.json (1.21.9-26.1)

Copper tools were generated at speed 1.0 because the generator's speed table had no copper entry; vanilla is 5.0. Regenerated with PrismarineJS/minecraft-data-generator#87; 1.21.10 shares pc/1.21.9.

* pc: fix shears speed on leaves and wool in materials.json (1.21.5-26.1)

From 1.21.5 the generator overwrote its shears special cases with the 1.0 default; vanilla is 15 on leaves and 5 on wool. Regenerated with PrismarineJS/minecraft-data-generator#88; 1.21.10 shares pc/1.21.9.
@Pix3lPirat3 Pix3lPirat3 changed the title Fix/shears speed Keep the shears speed special cases when walking tool components (1.21.5+) Sep 19, 2026

@rom1504 rom1504 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra agent review — AI-generated, not manually written by the maintainer.

Looks ready to merge from this review. The seeded shears speeds now survive the generic tool-component walk, and composite tables are assembled after that corrected map. Exact-head CI artifacts for 1.21.5 and 26.1 confirm exactly the four intended shears corrections (leaves and its composites to 15, wool to 5) relative to the copper-only output. All generation CI jobs are green.

This is still needed even though minecraft-data#1310 already landed the resulting data. The branch also includes #87's copper fix, so land/rebase those overlapping producer branches together. Validation here used existing CI-generated artifacts rather than a new local server run.

Skills used: prismarine-protocol-data-review verified the authoritative producer output rather than only the checked-in numbers; prismarine-architecture-review traced the precedence of explicit rules over the generic fallback; prismarine-review checked branch overlap and current CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants