Class SingleThreadQueueExtent
java.lang.Object
com.fastasyncworldedit.core.extent.processor.BatchProcessorHolder
com.fastasyncworldedit.core.extent.processor.ExtentBatchProcessorHolder
com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent
- All Implemented Interfaces:
IBatchProcessorHolder
,IBatchProcessor
,IChunkExtent<IQueueChunk>
,IQueueExtent<IQueueChunk>
,Trimable
,Extent
,InputExtent
,OutputExtent
,Flushable
public class SingleThreadQueueExtent
extends ExtentBatchProcessorHolder
implements IQueueExtent<IQueueChunk>
Single threaded implementation for IQueueExtent (still abstract) - Does not implement creation of
chunks (that has to implemented by the platform e.g., Bukkit)
This queue is reusable init(Extent, IChunkCache, IChunkCache)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fastasyncworldedit.core.queue.IChunkExtent
IChunkExtent.IChunkEntity
-
Constructor Summary
ConstructorDescriptionSingleThreadQueueExtent
(int minY, int maxY) New instance given inclusive world height bounds. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChunkLoad
(int cx, int cz) Load a chunk in the world associated with thisSingleThreadQueueExtent
instancecreate
(boolean isFull) Create a new root IChunk object.void
Must ensure it is not in the queue handler (i.e.void
Must ensure that it is enqueued with QueueHandlervoid
flush()
Flush all changes to the world.getCachedGet
(int chunkX, int chunkZ) Get the cached get object.getCachedSet
(int chunkX, int chunkZ) Get the cached chunk set object.int
getMaxY()
int
getMinY()
final IQueueChunk
getOrCreateChunk
(int x, int z) Get the IChunk at a position (and cache it if it's not already)getScope()
Default to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.void
init
(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set) Initialize the queueA filter block is used to iterate over blocks / positions.boolean
isEmpty()
boolean
void
Define a region to be "preloaded" to the number of chunks provided bySettings.QUEUE.PRELOAD_CHUNK_COUNT
protected void
reset()
Resets the queue.void
setFastMode
(boolean fastmode) void
setFaweExceptionArray
(boolean[] faweExceptionReasonsUsed) Sets the cached boolean array of lengthFaweException.Type.values().length
that determines if a thrownFaweException
of typeFaweException.Type
should be output to console, rethrown to attempt to be visible to the player, etc.int
size()
Returns the number of chunks in this queue.<V extends Future<V>>
Vsubmit
(IQueueChunk chunk) Submit the chunk so that it's changes are applied to the worldboolean
trim
(boolean aggressive) Trims the object, reducing its memory footprint.Methods inherited from class com.fastasyncworldedit.core.extent.processor.ExtentBatchProcessorHolder
addPostProcessor, addProcessor, disableHistory, enableHistory
Methods inherited from class com.fastasyncworldedit.core.extent.processor.BatchProcessorHolder
getPostProcessor, getProcessor, postProcess, postProcessSet, processSet, setPostProcessor, setProcessor, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addPostProcessor, addProcessor, addSchems, apply, cancel, center, contains, contains, countBlocks, countBlocks, disableHistory, enableHistory, generate, getBlockDistribution, getBlockDistributionWithData, getEntities, getEntities, getHighestTerrainBlock, getHighestTerrainBlock, getNearestSurfaceLayer, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, isWorld, lazyCopy, regenerateChunk, relight, relightBlock, relightSky, replaceBlocks, replaceBlocks, replaceBlocks, setBlocks, setBlocks, setBlocks, spawnResource
Methods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
trimNBT, trimY
Methods inherited from interface com.fastasyncworldedit.core.extent.processor.IBatchProcessorHolder
construct, getPostProcessor, getProcessor, join, joinPost, postProcess, postProcessSet, processGet, processSet, remove, setPostProcessor, setProcessor
Methods inherited from interface com.fastasyncworldedit.core.queue.IChunkExtent
createEntity, getBiome, getBiomeType, getBlock, getBrightness, getEmittedLight, getFullBlock, getOpacity, getSkyLight, removeEntity, setBiome, setBiome, setBlock, setBlockLight, setSkyLight, setTile
Methods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBlock, getBrightness, getEmittedLight, getFullBlock, getHeightMap, getOpacity, getSkyLight
Methods inherited from interface com.fastasyncworldedit.core.queue.IQueueExtent
apply, apply, commit, getMaximumPoint, getMinimumPoint, isQueueEnabled, wrap
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBlock, setBlockLight, setHeightMap, setSkyLight
-
Constructor Details
-
SingleThreadQueueExtent
public SingleThreadQueueExtent() -
SingleThreadQueueExtent
public SingleThreadQueueExtent(int minY, int maxY) New instance given inclusive world height bounds.
-
-
Method Details
-
enableQueue
public void enableQueue()Description copied from interface:IQueueExtent
Must ensure that it is enqueued with QueueHandler- Specified by:
enableQueue
in interfaceExtent
- Specified by:
enableQueue
in interfaceIQueueExtent<IQueueChunk>
-
disableQueue
public void disableQueue()Description copied from interface:IQueueExtent
Must ensure it is not in the queue handler (i.e. does not change blocks in the world)- Specified by:
disableQueue
in interfaceExtent
- Specified by:
disableQueue
in interfaceIQueueExtent<IQueueChunk>
-
getCachedGet
Description copied from interface:IQueueExtent
Get the cached get object. This is faster than getting the object using NMS and allows for wrapping.- Specified by:
getCachedGet
in interfaceIQueueExtent<IQueueChunk>
-
getCachedSet
Description copied from interface:IQueueExtent
Get the cached chunk set object.- Specified by:
getCachedSet
in interfaceIQueueExtent<IQueueChunk>
-
isFastMode
public boolean isFastMode()- Specified by:
isFastMode
in interfaceIQueueExtent<IQueueChunk>
-
setFastMode
public void setFastMode(boolean fastmode) - Specified by:
setFastMode
in interfaceIQueueExtent<IQueueChunk>
-
getMinY
public int getMinY() -
getMaxY
public int getMaxY() -
setFaweExceptionArray
public void setFaweExceptionArray(boolean[] faweExceptionReasonsUsed) Sets the cached boolean array of lengthFaweException.Type.values().length
that determines if a thrownFaweException
of typeFaweException.Type
should be output to console, rethrown to attempt to be visible to the player, etc. Allows the same array to be used as widely as possible across the edit to avoid spam to console.- Parameters:
faweExceptionReasonsUsed
- boolean array that should be cached where this method is called from of lengthFaweException.Type.values().length
-
reset
protected void reset()Resets the queue. -
init
Initialize the queue- Specified by:
init
in interfaceIQueueExtent<IQueueChunk>
- Parameters:
extent
- extent to useget
- cache of chunk GETset
- cache of chunk SET
-
size
public int size()Description copied from interface:IQueueExtent
Returns the number of chunks in this queue.- Specified by:
size
in interfaceIQueueExtent<IQueueChunk>
- Returns:
- the number of chunks in this queue
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIQueueExtent<IQueueChunk>
- Returns:
true
if this queue contains no elements
-
submit
Description copied from interface:IQueueExtent
Submit the chunk so that it's changes are applied to the world- Specified by:
submit
in interfaceIQueueExtent<IQueueChunk>
- Returns:
- Future
-
trim
public boolean trim(boolean aggressive) Description copied from interface:Trimable
Trims the object, reducing its memory footprint. -
getOrCreateChunk
Description copied from interface:IChunkExtent
Get the IChunk at a position (and cache it if it's not already)- Specified by:
getOrCreateChunk
in interfaceIChunkExtent<IQueueChunk>
- Returns:
- IChunk
-
addChunkLoad
public void addChunkLoad(int cx, int cz) Load a chunk in the world associated with thisSingleThreadQueueExtent
instance- Parameters:
cx
- chunk X coordinatecz
- chunk Z coordinate
-
preload
Define a region to be "preloaded" to the number of chunks provided bySettings.QUEUE.PRELOAD_CHUNK_COUNT
- Parameters:
region
- region of chunks
-
create
Description copied from interface:IQueueExtent
Create a new root IChunk object. Full chunks will be reused, so a more optimized chunk can be returned in that case.- Specified by:
create
in interfaceIQueueExtent<IQueueChunk>
- Parameters:
isFull
- true if a more optimized chunk should be returned- Returns:
- a more optimized chunk object
- See Also:
-
flush
public void flush()Description copied from interface:IQueueExtent
Flush all changes to the world. Best to call this async, so it doesn't hang the server.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceIBatchProcessor
- Specified by:
flush
in interfaceIQueueExtent<IQueueChunk>
- Overrides:
flush
in classBatchProcessorHolder
-
initFilterBlock
Description copied from interface:IQueueExtent
A filter block is used to iterate over blocks / positions. Essentially combines BlockVector3, Extent and BlockState functions in a way that avoids lookups.- Specified by:
initFilterBlock
in interfaceIQueueExtent<IQueueChunk>
-
getScope
Description copied from interface:IBatchProcessor
Default to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.- Specified by:
getScope
in interfaceIBatchProcessor
- Overrides:
getScope
in classBatchProcessorHolder
-