Efficient/Lag-free way of setting a biome?

Discussion in 'Plugin Development' started by AgarOther, Feb 13, 2024.

Thread Status:
Not open for further replies.
  1. Offline



    I'm currently working on a SkyBlock server and especially on the "/is biome" command which sets the player's island biome.

    This is currently my code, even though as of 1.20 there's been a new command called "fillbiome" in vanilla minecraft, so I'm not sure if a more efficient way of setting a biome is available.

    I'm using Spigot 1.20.4.

        public static void setIslandBiome(Player p, String b) {
            SkyPlayer sp = SkyPlayer.getSkyPlayer(p);
            double x_start = sp.getX_start();
            double x_end = sp.getX_end();
            double z_start = sp.getZ_start();
            double z_end = sp.getZ_end();
            for (double x = x_start; x <= x_end; x++) {
                for (double z = z_start; z <= z_end; z++) {
                    for (int y = 0; y <= 319; y++) {
                        Location loc = new Location(EleoPlugin.skyWorld, x, y, z);
                        World w = loc.getWorld();
                        if (w == null)
                        Biome biome;
                        switch (b) {
                            case "snow" -> biome = Biome.SNOWY_TAIGA;
                            case "desert" -> biome = Biome.DESERT;
                            case "savanna" -> biome = Biome.SAVANNA;
                            default -> biome = Biome.PLAINS;
                        w.setBiome(loc, biome);
            p.sendMessage(Utility.serverPrefix("island") + "Successfully set biome. Re-log in order to see the changes!");
    Last edited: Feb 13, 2024
Thread Status:
Not open for further replies.

Share This Page