Class Regenerator<IChunkAccess,ProtoChunk extends IChunkAccess,Chunk extends IChunkAccess,ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>>
java.lang.Object
com.fastasyncworldedit.bukkit.adapter.Regenerator<IChunkAccess,ProtoChunk,Chunk,ChunkStatus>
- Type Parameters:
IChunkAccess- the type of theIChunkAccessof the current Minecraft implementationProtoChunk- the type of theProtoChunkof the current Minecraft implementationChunk- the type of theChunkof the current Minecraft implementationChunkStatus- the type of theChunkStatusWrapperwrapping theChunkStatusenum
public abstract class Regenerator<IChunkAccess,ProtoChunk extends IChunkAccess,Chunk extends IChunkAccess,ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>>
extends Object
Represents an abstract regeneration handler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class is used to wrap the ChunkStatus of the current Minecraft implementation and as the implementation to execute a chunk generation step.static enumstatic classstatic classclassstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<ChunkStatus,Regenerator.Concurrency> protected booleanprotected final RegenOptionsprotected final Worldprotected final Regionprotected longprotected final Extent -
Constructor Summary
ConstructorsConstructorDescriptionRegenerator(World originalBukkitWorld, Region region, Extent target, RegenOptions options) Initializes an abstract regeneration handler. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcleanup()Implement the cleanup of all the mess that is created during the regeneration process (initNewWorld() and generate()).This function must not throw any exceptions.protected abstract ChunkcreateChunk(ProtoChunk protoChunk) Implement the convertion of aProtoChunkto aChunkhere.protected abstract ProtoChunkcreateProtoChunk(int x, int z) Implement the initialization of aProtoChunkhere.protected BiomeProviderprotected abstract List<BlockPopulator>Return a list ofBlockPopulatorused to populate the original world here.protected ChunkgetChunkAt(int x, int z) Returns theChunkat the given chunk coordinates.protected abstract ChunkStatusReturn theChunkStatus.FULLhere.protected ProtoChunkgetProtoChunkAt(int x, int z) Returns theProtoChunkat the given chunk coordinates.protected abstract booleanImplement the creation of the seperate world in here.protected abstract IChunkCache<IChunkGet>Implement the initialization anIChunkCache<IChunkGet>here.protected abstract voidpopulate(Chunk chunk, Random random, BlockPopulator pop) Implement the population of theChunkwith the given chunk random andBlockPopulatorhere.protected abstract booleanprepare()Implement the preparation process in here.booleanRegenerates the selectedRegion.
-
Field Details
-
originalBukkitWorld
-
region
-
target
-
options
-
chunkStati
protected final Map<ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>,Regenerator.Concurrency> chunkStati -
generateConcurrent
protected boolean generateConcurrent -
seed
protected long seed
-
-
Constructor Details
-
Regenerator
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 regeneratetarget- the targetExtentto paste the regenerated blocks intooptions- the options to used while regenerating and pasting into the targetExtent
-
-
Method Details
-
regenerate
Regenerates the selectedRegion.- Returns:
- whether or not the regeneration process was successful
- Throws:
Exception- when something goes terribly wrong
-
getProtoChunkAt
Returns theProtoChunkat the given chunk coordinates.- Parameters:
x- the chunk x coordinatez- the chunk z coordinate- Returns:
- the
ProtoChunkat the given chunk coordinates or null if it is not part of the regeneration process or has not been initialized yet.
-
getChunkAt
Returns theChunkat the given chunk coordinates.- Parameters:
x- the chunk x coordinatez- the chunk z coordinate- Returns:
- the
Chunkat the given chunk coordinates or null if it is not part of the regeneration process or has not been converted yet.
-
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
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. -
createProtoChunk
Implement the initialization of aProtoChunkhere.- Parameters:
x- the x coorinate of theProtoChunkto createz- the z coorinate of theProtoChunkto create- Returns:
- an initialized
ProtoChunk
-
createChunk
Implement the convertion of aProtoChunkto aChunkhere.- Parameters:
protoChunk- theProtoChunkto be converted to aChunk- Returns:
- the converted
Chunk
-
getFullChunkStatus
Return theChunkStatus.FULLhere. ChunkStatus.FULL is the last step of vanilla chunk generation.- Returns:
ChunkStatus.FULL
-
getBlockPopulators
Return a list ofBlockPopulatorused to populate the original world here.- Returns:
ChunkStatus.FULL
-
populate
Implement the population of theChunkwith the given chunk random andBlockPopulatorhere.- Parameters:
chunk- theChunkto populaterandom- the chunk random to use for populationpop- theBlockPopulatorto use
-
initSourceQueueCache
Implement the initialization anIChunkCache<IChunkGet>here. Use will need thegetChunkAtfunction- Returns:
- an initialized
IChunkCache<IChunkGet>
-
getBiomeProvider
-