WorldTools icon indicating copy to clipboard operation
WorldTools copied to clipboard

fix: emit vanilla-default rules with overrides on MP captures

Open terbin opened this issue 6 months ago • 0 comments

A vanilla MP server only sends the client the rules it has overridden, not the full rule set. Capturing on MP was therefore producing a LevelData with a partial rule set (the previous "client side game rules removed" ToDo path emitted an empty NbtCompound on MP), so loading the captured world in single-player behaved differently from a fresh SP launch.

On MP captures, default-construct GameRules(featureSet) to get the full vanilla rule set, then layer the configured overrides on top via putString. SP captures still take the live integrated-server rule set as the base. 1.21.4 has no GameRules.createCodec; toNbt() emits string-valued NbtCompound entries (the vanilla level.dat shape), so the overlay uses putString rather than putBoolean.

Verification

level.dat GameRules compound has 52 rules on an archive-survival capture, including server overrides (doFireTick = false, doMobSpawning = false, doDaylightCycle = false) layered over the vanilla defaults.

terbin avatar May 19 '26 01:05 terbin