World.regenerateChunk(x , z);

Discussion in 'Spigot Discussion' started by mcv, Jan 21, 2020.

  1. mcv

    mcv

    In the past, regenerateChunk() would rebuild the terrain based on the seed. Yes the trees would be random and some would be cut off at the chunks edge.

    Lately the method has been Deprecated with a message in the log saying unless you know how to "fix it" it's not a bug.

    First question: Is it deprecated because something changed making it impossible to regenerate the terrain (stone, dirt, grass) based on the seed? Or was it deprecated only because trees and spawned villages/etc would not be the same?

    If this method was abandon just because the trees get cut off or a villagers house might not be included in the regeneration, can't we still have the method regenerate just the landscape as it used to before 1.15.x?

    At least the option is there, if the trees are important to you then don't use it, same as now. But if you don't care about the trees and tall grass can we still have the method active again? It is very useful for removing something like a TNT crater, and then i can edit the trees by hand.

    Is there a work around? Say, delete the chunk and force the game to recreate it as if that chunk was never previously discovered? Is there a way to force-call the first time chunk generation on a given x,z?
     
  2. Absolutely agree with you mate. Spigot should have left the method in but labelled it with a warning. They've instead killed support entirely.
    You can still edit region files, but this is dangerous.
     
  3. As far as I know Mojang did, not spigot.
     
    • Agree Agree x 1
  4. An alternative for you if you still need it.. and something Spigot could have done :)

    public boolean regenerateChunk(Chunk chunk) {
    int bx = chunk.getX() << 4;
    int bz = chunk.getZ() << 4;
    try {
    BlockVector3 pt1 = BlockVector3.at(bx, 0, bz);
    BlockVector3 pt2 = BlockVector3.at(bx + 15, 256, bz + 15);
    BukkitWorld world = new BukkitWorld(chunk.getWorld());
    CuboidRegion region = new CuboidRegion(world, pt1, pt2);
    EditSession session = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 65536);
    boolean result = world.regenerate(region, session);
    session.flushSession();
    return result;
    } catch (Exception e) {

    e.printStackTrace();
    return false;
    }
    }
     
    • Like Like x 1