mojira.dev
MC-217802

Some blocks generate at wrong Y height in a superflat world

The bug

minecraft:grass, minecraft:flower_pot, carpets, snow and possibly more blocks generate on the wrong y level if min_y is below 0. (y of wrong level blocks = amount of layers) Basically forgets there are negative y levels.

[media]

 

How to reproduce

  1. Go to the flat world preset menu

  2. Fill in minecraft:bedrock,2*minecraft:dirt,minecraft:grass_block,minecraft:grass (you can replace grass with flower_pot or white_carpet for the same effect)

  3. Generate the world
    ❌  The grass generated at y = 4  

Code analysis

Using the official 21w08b mojmaps:

net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings

public int getMinBuildHeight() {
  return 0;
}
    
public int getHeight() {
  return 256;
}

These are hardcoded to the old limit, multiple things are calculated with that number, including the level height of the blocks like carpets, grass and snow etc(blocks that depend on blocks below it, flower_pot is a weird exception). Best solution is unhardcoding these.

Linked issues

Attachments

Comments 4

This is probably what causes MC-215036.

I can confirm. The following preset places the moss_carpet at y=4. It is the default superflat preset with a moss_carpet layer added on top of the grass blocks.

minecraft:bedrock,2*minecraft:dirt,minecraft:grass_block,minecraft:moss_carpet;minecraft:plains

BBLZ

migrated

Confirmed

(Unassigned)

21w08b, 21w10a

21w11a

Retrieved