Skip to content

Fix water/lava diggable by detecting fluid blocks from code - #80

Open
AnonymoDGH wants to merge 1 commit into
PrismarineJS:mainfrom
AnonymoDGH:fix/fluid-diggable
Open

Fix water/lava diggable by detecting fluid blocks from code#80
AnonymoDGH wants to merge 1 commit into
PrismarineJS:mainfrom
AnonymoDGH:fix/fluid-diggable

Conversation

@AnonymoDGH

Copy link
Copy Markdown

Fixes water/lava being marked diggable: true.

The bug

The diggable logic is hardness != -1.0f && !(block instanceof AirBlock). Fluids have a hardness of 100 (not -1), so water and lava were incorrectly marked diggable in every version that has fluid blocks.

The fix

Detect fluid blocks from the game code instead of hardcoding names — per @extremeheat's guidance on #79:

  • 1.13+ (Yarn & Mojmap): defaultState.getFluidState().isEmpty() — a block is diggable only if its default state has no fluid.
  • 1.7–1.12.2 (legacyYarn): Material.isFluid()!block.getMaterial().isFluid() for 1.7/1.8.9, !defaultState.getMaterial().isFluid() for 1.9.4–1.12.2.

No block names are hardcoded; the check queries the actual Minecraft source.

Verification

Every API was confirmed against the real mapping files for its era (Yarn v2 tiny mappings for 1.14/1.15/1.16/1.20, legacyYarn for 1.7–1.13, Mojmap for 1.21.5+):

  • BlockState.getFluidState() (no-arg) exists from 1.13 onward (on AbstractBlock.AbstractBlockState, inherited by BlockState).
  • FluidState.isEmpty() exists in all those versions.
  • Material.isFluid() exists in all legacyYarn versions.

CI runs runServer for all 28 versions, which compiles and executes each generator, so any wrong API will fail the build.

Water and lava blocks were incorrectly marked diggable=true because their hardness is 100 (not -1). Detect fluid blocks from the source instead of hardcoding names: use instanceof FluidBlock (yarn 1.14+), instanceof LiquidBlock (mojmap 1.21.5+), Material.isFluid() (legacy 1.7-1.12.2), and FlowingFluidBlock via net.minecraft.class_3710 (1.13.2). This mirrors the existing instanceof AirBlock check and only flips actual fluid blocks.
@AnonymoDGH

Copy link
Copy Markdown
Author

Verified against the freshly generated artifacts — diffing the PR branch output against main for all 28 versions:

diggable flips (the fix):

  • water, lava: true → false in every version
  • flowing_water, flowing_lava: true → false in 1.7–1.12.2
  • Exactly those blocks — nothing else flipped (no seagrass/kelp/corals/sea_pickle/conduit/bubble_column)

example diffs (all other versions identical in shape):

1.13.2: water true->false, lava true->false   (bubble_column stays true)
1.18:   water true->false, lava true->false
26.1:   water true->false, lava true->false

Only other difference across all versions: the drops field on 122 blocks in various versions — runtime non-determinism from loot-table evaluation at server boot (differs between independent CI runs on main too); unrelated to this change.

CI: all 28 Build jobs green. Also confirmed the 1.13.2 class net/minecraft/class_3710 (unmapped in legacyYarn) resolves in the intermediary fallback namespace and is exactly FlowingFluidBlock: it extends Block, implements FluidDrainable, holds a FlowableFluid, and has getFluidState/bucket methods — checked against the 1.13.2 server jar.

@extremeheat extremeheat changed the title 🎈 Fix water/lava diggable by detecting fluid blocks from code Fix water/lava diggable by detecting fluid blocks from code Aug 18, 2026
@extremeheat

Copy link
Copy Markdown
Member

Can you open PR in minecraft-data with the updated data?

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