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

Custom Nether world heights are 128; prior to 1.14 it was 256

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • Java 11; macOS

    • This server is running CraftBukkit version git-Spigot-e4be9b0-5736cdc (MC: 1.14) (Implementing API version 1.14-R0.1-SNAPSHOT)
    • Yes

      Custom Nether chunk generator's max world height is 128 in 1.14, but prior versions it was 256.

      It is possible to setBlocks in the nether above 128 using the World.setBlock method after the world is generated, but setting blocks above 128 using the ChunkGenerator does nothing (because the world maxHeight is 128).

      I'm wondering if this is a fundamental change or if this is something that Spigot defines so it can be set back to 256. 

      Minimal plugin source code and chunkGenerate class to show the difference:

      public class Test extends JavaPlugin {
          private ChunkGenerator chunkGen;
      
          @Override
          public void onEnable(){
              chunkGen = new ChunkGeneratorWorld();
              World nether = WorldCreator.name("test_nether").type(WorldType.FLAT).environment(Environment.NETHER).generator(chunkGen).createWorld();
              Bukkit.getLogger().info("DEBUG: The world height is " + nether.getMaxHeight());
              Bukkit.getLogger().info("DEBUG: The block type is " + nether.getBlockAt(0, 250, 0));
          }
      }
      
      -----
      
      public class ChunkGeneratorWorld extends ChunkGenerator {
      
          @Override
          public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biomeGrid) {
              ChunkData c = createChunkData(world);
              c.setBlock(0, 250, 0, Material.GLOWSTONE);
              return c;
          }
      
          @Override
          public boolean canSpawn(World world, int x, int z) {
              return true;
          }
      
          @Override
          public List<BlockPopulator> getDefaultPopulators(final World world) {
              return Collections.emptyList();
          }
      }

      Output:

      1.13.2:

      [17:54:30 INFO]: DEBUG: The world height is 256
      [17:54:30 INFO]: DEBUG: The block type is CraftBlock{pos=BlockPosition{x=0, y=250, z=0},type=GLOWSTONE,data=Block{minecraft:glowstone},fluid=net.minecraft.server.v1_13_R2.FluidTypeEmpty@226f885f}

      1.14:

      [17:52:15] [Server thread/INFO]: DEBUG: The world height is 128
      [17:52:15] [Server thread/INFO]: DEBUG: The block type is CraftBlock{pos=BlockPosition{x=0, y=250, z=0},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.server.v1_14_R1.FluidTypeEmpty@4c432866}
      

            Unassigned Unassigned
            tastybento tastybento
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: