mojira.dev
MC-278988

Specifying an object in the custom biome "features" array field does not prevent data packs from loading

Loading custom biome through data pack is an experiment feature. All experimental registers (like damage_type, worldgen/*, etc) have a feature where the game will refuse to load data packs if the JSON format or data type is incorrect. Instead of a simple warning and keep loading the data packs. But this is an exception.

If you attempt to load this file, the game output only warning this:

data/example/worldgen/biome/feature_object.json

...
  "carvers": [],
  "features": [
    {
      "feature": {
        "type": "minecraft:ore",
        "config": {
          "discard_chance_on_air_exposure": 0,
          "targets": [
            {
              "target": {
                "predicate_type": "minecraft:tag_match",
                "tag": "minecraft:base_stone_overworld"
              },
              "state": {
                "Name": "minecraft:orange_stained_glass_pane"
              }
            }
          ],
          "size": 20
        }
      },
      "placement": [
        {
          "type": "minecraft:count",
          "count": 4
        },
        {
          "type": "minecraft:height_range",
          "height": {
            "type": "minecraft:uniform",
            "min_inclusive": {
              "absolute": -30
            },
            "max_inclusive": {
              "absolute": 30
            }
          }
        },
        {
          "type": "minecraft:biome"
        }
      ]
    }
  ],
  "spawners": {},
...

game output

Features: Failed to parse either. First: Not a string: {"feature":{"type":"minecraft:ore","config":{"discard_chance_on_air_exposure":0,"targets":[{"target":{"predicate_type":"minecraft:tag_match","tag":"minecraft:base_stone_overworld"},"state":{"Name":"minecraft:orange_stained_glass_pane"}}],"size":20}},"placement":[{"type":"minecraft:count","count":4},{"type":"minecraft:height_range","height":{"type":"minecraft:uniform","min_inclusive":{"absolute":-30},"max_inclusive":{"absolute":30}}},{"type":"minecraft:biome"}]}; Second: Not a json array: {"feature":{"type":"minecraft:ore","config":{"discard_chance_on_air_exposure":0,"targets":[{"target":{"predicate_type":"minecraft:tag_match","tag":"minecraft:base_stone_overworld"},"state":{"Name":"minecraft:orange_stained_glass_pane"}}],"size":20}},"placement":[{"type":"minecraft:count","count":4},{"type":"minecraft:height_range","height":{"type":"minecraft:uniform","min_inclusive":{"absolute":-30},"max_inclusive":{"absolute":30}}},{"type":"minecraft:biome"}]}

Steps to Reproduce:

  1. Load this pack datapack_object.zip.

  2. Check the game output.

  3. Open Single Biome world type and search for the "example:feature_object".
    This biome appears in the list, which means that the game has loaded the biome correctly.

  4. Select it and create the world.

  5. When you enter the world, you can do them:

  1. Enter F3 and ckeck the biome.
    The biome is "example:feature_object".

  2. Run these command for search "orange_stained_glass_pane ore":

    /gamemode spectator @s
    /effect give @s minecraft:night_vision infinite 0 true

    There in no "orange_stained_glass_pane ore", which means that the features field is incorrectly.

The datapack_array.zip use correctly format, can generate "orange_stained_glass_pane ore",

These means set a object in "features" array field is a incorrectly format.

Expected Result:

Here should be "Data Pack Vaildation failed" screen and prevent loading world.

Observed Result.

See above. The biome loaded normally with game output warning.

Attachments

Comments 3

Thank you for your report!

 

Well, your JSON look ok, and when reading the error message, i see that the types are wrong.

The error message told you that you misused the variables, with things set to integer instead of string (number instead of text), same for the "not a json array". Maybe cleaning everything in the feature and adding things per little groups can make you find where are the problems exactly so you can check on the wiki for how to use correctly this experimental feature. It does not seem to be a game issue, but i don't know well this feature and i don't have the time to fix the code and analyzing how the feature work for now, so i let moderators and the community testing.

Good luck with your project!

I think I report a game issue, not a question about how to make data packs.
Any other experimental registries don't accept any incorrectly format json data. When it happened, the game will prevent players loading it instead of only ignoring errors and print warning to game output.
The game catch the json object and consider it's an error data, but not appearing "Data Pack Vaildation failed" screen. Obviously, this is inconsistent

Data pack validation screen only pops up when required data fails to load, such as required tags or dimension types, not any data error. 

wplxfore

(Unassigned)

Confirmed

Platform

Low

Data Packs

1.21.4, 1.21.5, 25w15a, 1.21.6, 1.21.8

Retrieved