Setting biomes not working

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • CraftBukkit version 3317-Spigot-b7a4222-c98abfb
    • my tester plugin
    • Yes

      I recently noticed setting biomes using 2 methods does not work
      Block#setBiome(Biome) and
      World#setBiome(x,y,z, biome)

      while World#setBiome(x,z, biome) (deprecated) does still work.

      Code to test:

      @Override
      public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
          if (sender instanceof Player) {
              if (args.length != 1) {
                  sender.sendMessage("Missing arg");
                  return true;
              }
              String arg = args[0];
      
              Player player = (Player) sender;
              Block targetBlock = player.getTargetBlockExact(50);
              assert targetBlock != null;
              Location location = targetBlock.getLocation();
              World world = targetBlock.getWorld();
      
              int blockX = location.getBlockX();
              int blockY = location.getBlockY();
              int blockZ = location.getBlockZ();
      
              for (int x = blockX - 10; x < blockX + 10; x++) {
                  for (int z = blockZ - 10; z < blockZ + 10; z++) {
                      for (int y = blockY - 5; y < blockY + 5; y++) {
                          switch (arg) {
                              case "block":
                                  world.getBlockAt(x, y, z).setBiome(Biome.WARM_OCEAN);
                                  break;
                              case "world3d":
                                  world.setBiome(x, y, z, Biome.WARM_OCEAN);
                                  break;
                              case "world2d":
                                  world.setBiome(x, z, Biome.WARM_OCEAN);
                                  break;
                          }
                      }
                  }
              }
          }
      
          return true;
      }
      

      this simple command just loops blocks in a 20x20 area, and sets the biomes.
      Based on the command arg used, it will use 1 of the 3 methods. The first 2 (block and world3d) do not work, but the world2d option (which is deprecated) does work.

      How to test:

      • install plugin and run server
      • I suggest finding a big area and running the command (I suggest standing in a PLAINS biome, as this command will set to warm ocean and its easy to see the diff):
        `/fill ~ ~ ~ ~50 ~-5 ~50 minecraft:grass_block` (this gives you a big workspace to work with)
      • I personally placed 3 signs in 3 corners of this grid to remember my areas I ran the commands (will see in pic)
      • run each command in these 3 corners:
      • "/test block"
      • "/test world3d"
      • "/test world2d"
      • log out, log back in (this refreshes the biome changes, as the server does not send this change to the client when these methods are used)
      • you will notice the WORLD2D area is updated, the other 2 are not (see pic)

      If you look in the grid area for "World2D" you will see a slight teal color to the grass (this is the color of grass in Biome.WARM_OCEAN), whereas the color of the grass in the other 2 areas remains unchanged (PLAINS)

            Assignee:
            Unassigned
            Reporter:
            Shane Bee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: