Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7952

CraftChunkData wrong variables handling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • 1.21.3
    • Yes

      in CraftChunkData the Method setRegion limits the height to the maxHeight but it will set Blocks withing the Bounds exclusive the maxX, maxY, maxZ it works for maxX and maxZ to set them to 16 because block-range is 0-15 (=16 Blocks) but not for the height... because the last Block at y would be the maxHeight-Block which is then exclusive and will not get placed

       

      public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockState type) {
          if (xMin <= 15 && yMin < this.maxHeight && zMin <= 15) {
              if (xMin < 0) {
                  xMin = 0;
              }
      
              if (yMin < this.minHeight) {
                  yMin = this.minHeight;
              }
      
              if (zMin < 0) {
                  zMin = 0;
              }
      
              if (xMax > 16) {
                  xMax = 16;
              }
      
              if (yMax > this.maxHeight) {
                  yMax = this.maxHeight;
              }
      
              if (zMax > 16) {
                  zMax = 16;
              }
      
              if (xMin < xMax && yMin < yMax && zMin < zMax) {
                  for(int y = yMin; y < yMax; ++y) {
                      for(int x = xMin; x < xMax; ++x) {
                          for(int z = zMin; z < zMax; ++z) {
                              this.setBlock(x, y, z, type);
                          }
                      }
                  }
      
              }
          }
      }
      

      The fix would be to limit the yMax to this.maxHeight+1

      Also the setBlock Method limits the y to lower maxHeight

       

            Unassigned Unassigned
            FreeSoccerHDX FreeSoccerHDX
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: