Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-258859

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.19.3
    • None
    • Plausible
    • World generation

      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.

       

       

        1. east.png
          east.png
          1.15 MB
        2. north.png
          north.png
          1.12 MB
        3. south.png
          south.png
          1.11 MB
        4. west.png
          west.png
          1.19 MB

            Unassigned Unassigned
            LegoEmmetMC Apollo
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: