Skip to content

Add DataOverrides layer to keep corrected values stable across regenerations - #79

Closed
AnonymoDGH wants to merge 1 commit into
PrismarineJS:mainfrom
AnonymoDGH:fix/data-overrides
Closed

AnonymoDGH wants to merge 1 commit into
PrismarineJS:mainfrom
AnonymoDGH:fix/data-overrides

Conversation

@AnonymoDGH

Copy link
Copy Markdown

What

Adds a small override layer (DataOverrides) applied by the shared DataGenerators pipeline right before each generated JSON file is written out. It guarantees that a handful of values the community-verified minecraft-data dataset expects stay correct no matter how often a version is regenerated — this fixes the situation where manual data fixes to generated versions silently revert to the previous state (see the note on PrismarineJS/minecraft-data#1234).

Overrides included

Each override is version-gated and only writes the corrected value, so it is a no-op when the game already reports the expected value.

Notes

  • The overrides live in common post-processing, so every mc/<version> module picks them up automatically, including future versions.
  • CI regenerates data for all 28 versions on this PR, validating the overrides end-to-end.

@extremeheat

Copy link
Copy Markdown
Member

Why is the data returned by the actual Minecraft code wrong ?

@extremeheat

Copy link
Copy Markdown
Member

Injecting a bunch of hard coded (likely wrong) things here when whole point is to get the proper data from the source doesn't seem to make sense

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a shared post-processing override layer in common so a small set of community-verified corrections stay stable across regenerations for all supported Minecraft versions.

Changes:

  • Thread versionName into the shared generation pipeline so overrides can be version-gated.
  • Apply DataOverrides to selected generated datasets (items, blocks, effects) immediately before writing JSON.
  • Introduce DataOverrides with targeted, version-scoped corrections for known minecraft-data inconsistencies.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java Passes versionName into the shared generator pipeline so post-processing can be version-aware.
common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java Invokes DataOverrides.apply(...) right before each generated JSON file is written.
common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataOverrides.java New centralized override layer implementing the version-gated corrections.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +84 to +87
private static void applyEffects(JsonArray effects, String versionName) {
if (!atLeast(versionName, "1.14.4") || !before(versionName, "1.17")) {
return;
}
@AnonymoDGH

Copy link
Copy Markdown
Author

Closing this in favor of a more targeted approach — @extremeheat's point is well taken.

I compared the generator's actual output on main (CI artifacts, no overrides) against minecraft-data master:

case generator main minecraft-data master verdict
warped_fungus_on_a_stick stackSize 1 (correct) 64 master is stale
copper_ore hardness/resistance 3/3 (correct) 0/0 master is stale
effects ids 28-32 correct, no dupes BadOmen=32 + duplicate DolphinsGrace master is stale
water/lava diggable true (wrong) true real generator bug

So 3 of the 4 overrides here were redundant — the generator already returns the right values and the committed minecraft-data files are simply stale (a regeneration would fix them). Hardcoding those was the wrong call.

The one genuine bug is diggable for fluids: the logic hardness != -1.0f && !(block instanceof AirBlock) marks water/lava diggable because their hardness is 100, not -1. That's wrong in all 27 versions that have fluid blocks. I'll open a focused PR that fixes just that by detecting fluid blocks from the code instead of hardcoding names.

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

Labels

None yet

Projects

None yet

3 participants