Fix water/lava diggable by detecting fluid blocks from code - #80
Fix water/lava diggable by detecting fluid blocks from code#80AnonymoDGH wants to merge 1 commit into
Conversation
5768b7c to
fc85919
Compare
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.
fc85919 to
4e3659d
Compare
|
Verified against the freshly generated artifacts — diffing the PR branch output against diggable flips (the fix):
example diffs (all other versions identical in shape): Only other difference across all versions: the CI: all 28 |
|
Can you open PR in minecraft-data with the updated data? |
Fixes water/lava being marked
diggable: true.The bug
The
diggablelogic ishardness != -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:
defaultState.getFluidState().isEmpty()— a block is diggable only if its default state has no fluid.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 (onAbstractBlock.AbstractBlockState, inherited byBlockState).FluidState.isEmpty()exists in all those versions.Material.isFluid()exists in all legacyYarn versions.CI runs
runServerfor all 28 versions, which compiles and executes each generator, so any wrong API will fail the build.