mojira.dev
MC-258859

Steep surface rule condition only works on the north and east faces of slopes

The Bug

The steep surface rule in vanilla is used to make steep areas stone in the Snowy Slopes and Jagged Peaks biomes and packed ice in the Frozen Peaks biome. However, this only works on the north and east faces of steep areas. See the attached images to see how this looks in game.

 

Code Analysis

Here's the code analysis. It uses 1.19.3 with the official deobfuscation mappings.

 

net.minecraft.world.level.levelgen.SurfaceRules.Context.SteepMaterialCondition
SurfaceRules.Context.SteepMaterialCondition(SurfaceRules.Context $$0) {
  super($$0);
}

@Override
protected boolean compute() {
  int $$10;
  int $$0 = this.context.blockX & 0xF;
  int $$1 = this.context.blockZ & 0xF;
  int $$2 = Math.max($$1 - 1, 0);
  int $$3 = Math.min($$1 + 1, 15);
  ChunkAccess $$4 = this.context.chunk;
  int $$5 = $$4.getHeight(Heightmap.Types.WORLD_SURFACE_WG, $$0, $$2);
  int $$6 = $$4.getHeight(Heightmap.Types.WORLD_SURFACE_WG, $$0, $$3);
  if ($$6 >= $$5 + 4) {
    return true;
  }
  int $$7 = Math.max($$0 - 1, 0);
  int $$8 = Math.min($$0 + 1, 15);
  int $$9 = $$4.getHeight(Heightmap.Types.WORLD_SURFACE_WG, $$7, $$1);
  return $$9
      >= ($$10 = $$4.getHeight(Heightmap.Types.WORLD_SURFACE_WG, $$8, $$1)) + 4;
}

The issue here is that the condition only passes if the heightmap on the block being sampled to the south/west of the original block is 4 or more blocks higher than the north/east block, and never checks for if the block samplied to the north/east of the original block is 4 or more blocks higher than the south/west block.

Fix

This can be fixed by checking if the total difference between the heightmap of the south/west and north/east block (respectively) is 4 or greater.

 

 

Attachments

Comments 0

No comments.

Apollo

(Unassigned)

Plausible

World generation

1.19.3

Retrieved