mojira.dev
MC-264886

Geode features ignore the invalid_blocks field

The bug

Geode features do not use the block tag from the invalid_blocks field, and instead always use the #minecraft:geode_invalid_blocks tag.

How to reproduce

Create a new world using the attached data pack. The data pack adds #minecraft:base_stone_overworld to #geode_invalid_blocks, but configures geodes to use an empty block tag (instead of #minecraft:geode_invalid_blocks) for its list of invalid blocks.

Expected behavior

Geodes should be generated, as they are configured by the data pack to use an empty block tag as their invalid block list.

Observed behavior

Geodes are not generated, since #geode_invalid_blocks (modified by the data pack to include stone, deepslate, etc.) is still being used (instead of the provided empty block tag).

Code analysis

1.20.1 with MCP-Reborn

net.minecraft.world.level.levelgen.feature.GeodeFeature.place

for(int i1 = 0; i1 < k; ++i1) {
   int j1 = geodeconfiguration.outerWallDistance.sample(randomsource);
   int k1 = geodeconfiguration.outerWallDistance.sample(randomsource);
   int l1 = geodeconfiguration.outerWallDistance.sample(randomsource);
   BlockPos blockpos1 = blockpos.offset(j1, k1, l1);
   BlockState blockstate = worldgenlevel.getBlockState(blockpos1);
   if (blockstate.isAir() || blockstate.is({*}BlockTags.GEODE_INVALID_BLOCKS{*})) {
     ++l;
     if (l > geodeconfiguration.invalidBlocksThreshold) {
       return false;
     }
   }
   list.add(Pair.of(blockpos1, geodeconfiguration.pointOffset.sample(randomsource)));
}

Changing BlockTags.GEODE_INVALID_BLOCKS to geodeconfiguration.geodeBlockSettings.invalidBlocks should fix the issue.

Attachments

Comments 3

Do you happen to know the way in which this impacts world generation and/or data packs?

Plausible, does have impact,but not too major.

If a data pack overwrites the geode feature to use a different block tag, it will not use said block tag, but rather #minecraft:geode_invalid_blocks still.

Thanks, @unknown. I've attached a data pack that exhibits the behaviour you described.

Apollo

Tommy Wallberg

Confirmed

Platform

Normal

World generation

custom-worldgen, world-generation

1.20.1, 23w32a

24w33a

Retrieved