Class Regenerator

java.lang.Object
com.fastasyncworldedit.bukkit.adapter.Regenerator

public abstract class Regenerator extends Object
Represents an abstract regeneration handler.
  • Field Details

    • originalBukkitWorld

      protected final World originalBukkitWorld
    • region

      protected final Region region
    • target

      protected final Extent target
    • options

      protected final RegenOptions options
    • seed

      protected long seed
    • source

      protected SingleThreadQueueExtent source
  • Constructor Details

    • Regenerator

      public Regenerator(World originalBukkitWorld, Region region, Extent target, RegenOptions options)
      Initializes an abstract regeneration handler.
      Parameters:
      originalBukkitWorld - the Bukkit world containing all the information on how to regenerate the {code Region}
      region - the selection to regenerate
      target - the target Extent to paste the regenerated blocks into
      options - the options to used while regenerating and pasting into the target Extent
  • Method Details

    • regenerate

      public boolean regenerate() throws Exception
      Regenerates the selected Region.
      Returns:
      whether the regeneration process was successful
      Throws:
      Exception - when something goes terribly wrong
    • runTasks

      protected abstract void runTasks(BooleanSupplier shouldKeepTicking)
      Execute tasks on the main thread during regen.
    • prepare

      protected abstract boolean prepare()

      Implement the preparation process in here. DO NOT instanciate any variable here that require the cleanup function. This function is for gathering further information before initializing a new world.

      Fields required to be initialized: chunkStati, seed

      For chunkStati also see {code ChunkStatusWrapper}.

      Returns:
      whether or not the preparation process was successful
    • initNewWorld

      protected abstract boolean initNewWorld() throws Exception
      Implement the creation of the seperate world in here.

      Fields required to be initialized: generateConcurrent

      Returns:
      true if everything went fine, otherwise false. When false is returned the Regenerator halts the regeneration process and calls the cleanup function.
      Throws:
      Exception - When the implementation of this method throws and exception the Regenerator halts the regeneration process and calls the cleanup function.
    • cleanup

      protected abstract void cleanup()
      Implement the cleanup of all the mess that is created during the regeneration process (initNewWorld() and generate()).This function must not throw any exceptions.
    • initSourceQueueCache

      protected abstract IChunkCache<IChunkGet> initSourceQueueCache()
      Implement the initialization an IChunkCache<IChunkGet> here. Use will need the getChunkAt function
      Returns:
      an initialized IChunkCache<IChunkGet>
    • getBiomeProvider

      protected BiomeProvider getBiomeProvider()