Summary
When noise_provider block state provider has empty states, it should cause pack validation to fail; currently it does not, instead causing a crash. (This issue exists in 1.20.6 as well.)
Steps to Reproduce
Add the attached pack.
Get a pair of boots with the enchantment
test:noise.Wear it.
Expected Result
The data pack should fail to validate.
Actual Result
Game crashes.
This also affects the
minecraft:noise_threshold_providerblock state provider'slow_statesandhigh_statesfields, though the code paths are unrelated.Code analysis (Yarn mappings)
These issues come from unchecked list sizes in the
NoiseBlockStateProvider#getStateAtValueandNoiseThresholdBlockStateProvider#getmethods.The fix is the same for both: replacing the
Codec.list(BlockState.CODEC)fields withCodecs.nonEmptyList(BlockState.CODEC). This is the same approach that, for example, world generation features take.