Skip to content

pc: fix block material for tier-gated blocks (1.20.5 - 26.1) - #1307

Open
Pix3lPirat3 wants to merge 4 commits into
PrismarineJS:masterfrom
Pix3lPirat3:fix/pc-material-priority
Open

Pix3lPirat3 wants to merge 4 commits into
PrismarineJS:masterfrom
Pix3lPirat3:fix/pc-material-priority

Conversation

@Pix3lPirat3

Copy link
Copy Markdown
Contributor

Since 1.20.5, blocks with a tool-tier requirement (ores, obsidian, metal blocks, ancient debris; 60–108 per version) have material: incorrect_for_wooden_tool. That tag gates drops, not speed, and its materials.json table lists only the four wooden tools, so prismarine-block digTime() misses the lookup for any better tool and falls back to hand speed, also skipping Efficiency. Iron ore with a diamond pickaxe reports 4550 ms instead of 600 ms; with Efficiency V, 30x too slow. Fixes #987; PrismarineJS/mineflayer#3921 and PrismarineJS/mineflayer#4131 are the same bug.

Supersedes #1193 and #1232.

The generator fix is PrismarineJS/minecraft-data-generator#71 (merged July) corrected by PrismarineJS/minecraft-data-generator#86, which also stops #71 from demoting the composite materials that carry sword and shears speeds. No data has been regenerated since PrismarineJS/minecraft-data-generator#71, so this applies that output.

Change: material only, incorrect_for_wooden_tool -> mineable/pickaxe, for 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 and 26.1. For every directory with a generator module, every block's material now equals the PrismarineJS/minecraft-data-generator#86 output. 1.21.4 has no generator module; the same mapping is applied, and all 93 blocks are mineable/pickaxe in both the 1.21.3 and 1.21.5 generator outputs. harvestTools and materials.json are untouched, so canHarvest is unchanged.

Verification: tools/js suite passes (1860). digTime() for every changed block matches the vanilla formula across all tool tiers and types on every version (e.g. 26.1: 3024/3024, was 2160). Live on vanilla 26.1 with mineflayer 4.39.0, iron ore breaks in 607 ms (was 4558 ms) and sword/shears times on melon, leaves and vine are unchanged.

Not included: drops (loot sampling differs between generator runs of the same version), and the 1.20.5 update_1_21 experimental blocks that the generator now resolves with feature-flag packs enabled — a separate cause, left for a 1.20.5 refresh.

Set material to mineable/pickaxe for every block that carried incorrect_for_wooden_tool. That tag gates drops, not speed, and its speed table only lists wooden tools, so prismarine-block digTime() fell back to hand speed for any better pickaxe. Generated with PrismarineJS/minecraft-data-generator#86; 1.21.4 has no generator module and receives the same mapping.
DallasCarraher added a commit to DallasCarraher/minecraft-data that referenced this pull request Sep 18, 2026
…aterial for 26.2

- Revert latest/proto.yml particle enum rename (trial_spawner_detection ->
  trial_spawner_detected_player) to match the naming still used by all
  other proto.yml versions, avoiding an inconsistent one-off rename scoped
  to this PR; regenerate 26.2/protocol.json to match.
- Fix 26.2/blocks.json: 108 ore/obsidian/metal blocks carried
  material: incorrect_for_wooden_tool instead of mineable/pickaxe, which
  made prismarine-block digTime() ~8x too slow for them. Apply the same
  mapping used by PrismarineJS#1307 for 1.20.5-26.1 so 26.2 doesn't regress.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…fix to 26.1

Skip incorrect_for_* tags when picking a block's material instead of
preferring the first mineable/* material. PrismarineJS#71's filter also outranked the
composite materials (plant, leaves, gourd, vine, sword_instantly_mines),
which are the only ones carrying sword and shears speeds. Composites are
registered first, so first-match order is kept and only the drop-gating
tags are skipped. 26.1 was added without PrismarineJS#71 and gets the same rule.
@Pix3lPirat3

Copy link
Copy Markdown
Contributor Author

Updated with the composite fix from generator #86 (second commit there): moss carpet, pink petals and pale moss carpet on 1.20.5 to 1.21.4 are now plant;mineable/hoe and bamboo on 1.21.5+ is sword_instantly_mines;mineable/axe, with the two merged tables added to materials.json, so the hoe and axe speeds are kept next to the sword rules. The 1.20.5 regeneration also corrects 55 blocks the shipped file still had as default (tuff variants, chiseled copper, copper doors/trapdoors/grates/bulbs, crafter, heavy core: all mineable/pickaxe). Every material field in the ten directories now equals the regenerated output

The composite tables were generated before the shears (1.21.5+) and copper tool (1.21.9+) speed fixes landed on master, so the branch carried the old 1.0 values for those entries. Regenerated from the generator with its composite, shears and 1.21.4 changes applied; existing tables now match master and only plant;mineable/hoe and sword_instantly_mines;mineable/axe are added.
extremeheat pushed a commit that referenced this pull request Sep 19, 2026
* Add Minecraft PC 26.2 data

Registers protocol 776 (26.2) with real generated data: blocks, items,
entities, recipes, language, commands, protocol.json (regenerated from
proto.yml), loot tables, and the rest of the per-version files. Also
adds a 1.20.3 windows.json with the crafter menu (missing since 1.20.3)
so 26.2's windows entry is accurate.

Extracted from the 26.2 portion of #1287,
which additionally carries unrelated fixes for 1.13.1, 1.14.2, 1.9.1
and a broader commands.json refresh across older versions. This commit
isolates just the 26.2 data so it can be reviewed and merged
independently of that larger changeset.

effects/enchantments/instruments are borrowed from 26.1 since those
registries are unchanged in 26.2.

Full mocha suite passes (1887 passing, 1 pending, 0 failing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix sulfur_cube_content type reuse; restore ItemStackTemplate regression

Addresses review feedback on this PR:

- sulfur_cube_content duplicated ItemStackTemplate's shape inline
  instead of referencing it. Verified against the real 26.2 server jar:
  net.minecraft.world.item.component.SulfurCubeContent is a record with
  a single field of type net.minecraft.world.item.ItemStackTemplate (no
  array wrapper) — Mojang's own internal type has the same name and
  shape minecraft-data already used. Now just `if sulfur_cube_content:
  ItemStackTemplate`.

- packet_spectator_action: verified this is a genuine rename, not a
  new packet alongside the old one. Decompiled the real 26.2 server
  jar: net/minecraft/network/protocol/game/ServerboundSpectatorActionPacket
  exists (a Record with one field, `OptionalInt spectateEntityId`,
  handled via `handleSpectatorAction`); no ServerboundSpectateEntityPacket
  class exists anywhere in the jar. Matches this PR's existing encoding
  (`entityId?: varint`) exactly — no data change needed for this one.

- Separately: rebasing this branch onto pc_26_2 silently regressed
  #1267's ItemStackTemplate fix throughout data/pc/latest/proto.yml —
  git's merge applied both sides' overlapping edits to this file in a
  way that dropped #1267's hunks without flagging a conflict. Restored
  all of it (intangible_projectile NBT, and ItemStackTemplate at
  use_remainder/charged_projectiles/bundle_contents/container/particle
  item/SlotDisplay item_stack/advancement icon) and regenerated
  data/pc/26.2/protocol.json from the corrected proto.yml.

Full test suite still green: 1887 passing, 1 pending, 0 failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address review findings: teleport regression, spectator_action encoding, cubemob metadata, bee size, knockback_resistance min

All five verified by decompiling the real 26.2 server jar
(versions/26.2/server-26.2.jar) with CFR, cross-referenced against
extremeheat/extracted_minecraft_data where cited in review.

- packet_entity_teleport: the pc_26_2 rebase also silently dropped
  #1273's 1.21.2+ layout fix (dx/dy/dz, f32 yaw/pitch,
  PositionUpdateRelatives flags) the same way it dropped #1267's
  ItemStackTemplate fix. Restored — ClientboundTeleportEntityPacket
  still uses PositionMoveRotation in 26.2, confirmed against the real
  class.

- packet_spectator_action: entityId?: varint (protodef presence-byte
  optional) doesn't match vanilla's wire format. Decompiled
  ByteBufCodecs.OPTIONAL_VAR_INT: it maps a single raw VarInt directly
  (no separate presence byte) — 0 = absent, n = entity id (n - 1).
  Changed to `entityId: optvarint`, the same sentinel-varint alias
  already used for entity metadata's optional_block_state/
  optional_unsigned_int.

- data/pc/26.2/entities.json: slime/magma_cube/sulfur_cube were
  missing the `baby`/`age_locked` metadata keys AgeableMob defines
  (confirmed via SynchedEntityData.defineId call order in
  AgeableMob/AbstractCubeMob/SulfurCube bytecode), and sulfur_cube had
  max_fuse/from_bucket swapped. Fixed all three to
  mob_flags, baby, age_locked, size, max_fuse, from_bucket.

- bee width/height: EntityTypes.BEE registers .sized(0.55f, 0.5f) in
  26.2; entities.json still had 26.1's 0.7/0.6. Fixed.

- data/pc/26.2/attributes.json: knockbackResistance's min was 0.0;
  Attributes.KNOCKBACK_RESISTANCE registers RangedAttribute(default
  0.0, min -2.0, max 1.0). Fixed.

Full test suite still green: 1887 passing, 1 pending, 0 failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address review: preserve trial_spawner particle naming, fix pickaxe material for 26.2

- Revert latest/proto.yml particle enum rename (trial_spawner_detection ->
  trial_spawner_detected_player) to match the naming still used by all
  other proto.yml versions, avoiding an inconsistent one-off rename scoped
  to this PR; regenerate 26.2/protocol.json to match.
- Fix 26.2/blocks.json: 108 ore/obsidian/metal blocks carried
  material: incorrect_for_wooden_tool instead of mineable/pickaxe, which
  made prismarine-block digTime() ~8x too slow for them. Apply the same
  mapping used by #1307 for 1.20.5-26.1 so 26.2 doesn't regress.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

@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 for these material corrections. I checked every changed block field and material-table entry: unrelated block fields, including harvestTools, are preserved; the new composite tables merge their existing component tables correctly. Exact-head generator#86 artifacts agree with all block material fields in 1.20.5, 1.21.3 and 26.1. Production prismarine-block probes across all ten changed directories confirm ore speed and preserve the repaired moss-carpet/hoe and bamboo/axe cases.

Affected schema checks: 97 passing. Current CI is green. The broader local run had 1,895 passing assertions, with failures only in the protocol-sync timeout and overall runtime guard during concurrent execution; I am not reporting that run as a clean full-suite pass. No new live server was run.

Skills used: prismarine-protocol-data-review checked generated facts, precise field scope and actual downstream selection; prismarine-architecture-review checked the composite representation and producer repair; prismarine-review verified the current repaired revision and validation limits.

This branch has not been deployed

No deployments
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.

Why "incorrect_for_wooden_tool"?

2 participants