Class DiskOptimizedClipboard
java.lang.Object
com.fastasyncworldedit.core.extent.clipboard.SimpleClipboard
com.fastasyncworldedit.core.extent.clipboard.LinearClipboard
com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard
- All Implemented Interfaces:
Clipboard
,Extent
,InputExtent
,OutputExtent
,Closeable
,Flushable
,AutoCloseable
,Iterable<BlockVector3>
A clipboard with disk backed storage. (lower memory + loads on crash)
- Uses an auto closable RandomAccessFile for getting / setting id / data
- I don't know how to reduce nbt / entities to O(2) complexity, so it is stored in memory.
-
Field Summary
FieldsFields inherited from class com.fastasyncworldedit.core.extent.clipboard.LinearClipboard
entities
Fields inherited from class com.fastasyncworldedit.core.extent.clipboard.SimpleClipboard
offset
-
Constructor Summary
ConstructorsConstructorDescriptionDiskOptimizedClipboard
(BlockVector3 dimensions) Deprecated, for removal: This API element is subject to removal in a future version.DiskOptimizedClipboard
(BlockVector3 dimensions, File file) New DiskOptimizedClipboard.DiskOptimizedClipboard
(Region region, UUID uuid) Creates a new DiskOptimizedClipboard for the given region.DiskOptimizedClipboard
(File file) Deprecated, for removal: This API element is subject to removal in a future version.Will be made private, useloadFromFile(File)
DiskOptimizedClipboard
(File file, int versionOverride) Deprecated, for removal: This API element is subject to removal in a future version.Will be made private, useloadFromFile(File)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the clipboard.void
flush()
Flush the clipboard if appropriate.getBiome
(int index) getBiome
(BlockVector3 position) Get the biome at the given location.int
getBiomeIndex
(int x, int y, int z) getBiomeType
(int x, int y, int z) getBlock
(int index) getBlock
(int x, int y, int z) getFile()
getFullBlock
(int i) getFullBlock
(int x, int y, int z) int
getIndex
(int x, int y, int z) getURI()
boolean
Returns true if the clipboard has biome data.static DiskOptimizedClipboard
loadFromFile
(File file) Attempt to load a file into a newDiskOptimizedClipboard
instance.boolean
void
boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.<B extends BlockStateHolder<B>>
booleansetBlock
(int x, int y, int z, B block) <B extends BlockStateHolder<B>>
booleansetBlock
(int i, B block) protected void
setOffset
(BlockVector3 offset) void
setOrigin
(BlockVector3 origin) Set the origin point from which the copy was made from.boolean
setTile
(int x, int y, int z, CompoundTag tag) void
streamBiomes
(IntValueReader task) The locations provided are relative to the clipboard minMethods inherited from class com.fastasyncworldedit.core.extent.clipboard.LinearClipboard
createEntity, createEntity, finalize, getEntities, getEntities, iterator, iterator, removeEntity, removeEntity
Methods inherited from class com.fastasyncworldedit.core.extent.clipboard.SimpleClipboard
getArea, getDimensions, getHeight, getLength, getMaximumPoint, getMinimumPoint, getOrigin, getRegion, getVolume, getWidth
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extent.clipboard.Clipboard
apply, iterator2d, paste, paste, paste, paste, paste, paste, save, save
Methods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addPostProcessor, addProcessor, addSchems, apply, cancel, center, commit, contains, contains, countBlocks, countBlocks, disableHistory, disableQueue, enableHistory, enableQueue, generate, getBlockDistribution, getBlockDistributionWithData, getHighestTerrainBlock, getHighestTerrainBlock, getMaxY, getMinY, getNearestSurfaceLayer, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, isQueueEnabled, isWorld, lazyCopy, regenerateChunk, relight, relightBlock, relightSky, replaceBlocks, replaceBlocks, replaceBlocks, setBlocks, setBlocks, setBlocks, spawnResource
Methods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBlock, getBrightness, getBrightness, getEmittedLight, getEmittedLight, getFullBlock, getHeightMap, getOpacity, getOpacity, getSkyLight, getSkyLight
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBlock, setBlockLight, setBlockLight, setHeightMap, setSkyLight, setSkyLight
-
Field Details
-
VERSION
public static final int VERSION- See Also:
-
-
Constructor Details
-
DiskOptimizedClipboard
Creates a new DiskOptimizedClipboard for the given region. Creates or overwrites a file using the given UUID as a name. -
DiskOptimizedClipboard
Deprecated, for removal: This API element is subject to removal in a future version.UseDiskOptimizedClipboard(Region, UUID)
orDiskOptimizedClipboard(BlockVector3, File)
to avoid creating a large number of clipboard files that won't be cleaned until `clipboard.delete-after-days` and a server restart.Creates a new DiskOptimizedClipboard with the given dimensions. Creates a new file with a random UUID name. -
DiskOptimizedClipboard
New DiskOptimizedClipboard. If the file specified exists, then it will be completely overwritten. To load an existing clipboard, useDiskOptimizedClipboard(File)
. -
DiskOptimizedClipboard
Deprecated, for removal: This API element is subject to removal in a future version.Will be made private, useloadFromFile(File)
Load an existing file as a DiskOptimizedClipboard. The file MUST exist and MUST be created as a DiskOptimizedClipboard with data written to it. -
DiskOptimizedClipboard
@Deprecated(forRemoval=true, since="2.6.2") public DiskOptimizedClipboard(File file, int versionOverride) Deprecated, for removal: This API element is subject to removal in a future version.Will be made private, useloadFromFile(File)
Load an existing file as a DiskOptimizedClipboard. The file MUST exist and MUST be created as a DiskOptimizedClipboard with data written to it.- Parameters:
file
- File to read fromversionOverride
- An override version to allow loading of older clipboards if required
-
-
Method Details
-
loadFromFile
Attempt to load a file into a newDiskOptimizedClipboard
instance. Will attempt to recover on version mismatch failure.- Parameters:
file
- File to load- Returns:
- new
DiskOptimizedClipboard
instance.
-
getURI
-
getFile
-
hasBiomes
public boolean hasBiomes()Description copied from interface:Clipboard
Returns true if the clipboard has biome data. This can be checked sinceInputExtent.getBiome(BlockVector2)
strongly suggests returningBiomeTypes.OCEAN
instead ofnull
if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting to ocean, instead of having biomes explicitly set.- Returns:
- true if the clipboard has biome data set
-
setBiome
Description copied from interface:OutputExtent
Set the biome.As implementation varies per Minecraft version, this may set more than this position's biome. On versions prior to 1.15, this will set the entire column. On later versions it will set the 4x4x4 cube.
- Parameters:
position
- the (x, y, z) location to set the biome atbiome
- the biome to set to- Returns:
- true if the biome was successfully set (return value may not be accurate)
-
setBiome
-
setBiome
- Specified by:
setBiome
in classLinearClipboard
-
getBiome
- Specified by:
getBiome
in classLinearClipboard
-
streamBiomes
Description copied from class:LinearClipboard
The locations provided are relative to the clipboard min- Specified by:
streamBiomes
in classLinearClipboard
-
getBiomeType
-
getBiome
Description copied from interface:InputExtent
Get the biome at the given location.If there is no biome available, then the ocean biome should be returned.
As implementation varies per Minecraft version, this may not exactly get this positions biome. On versions prior to 1.15, this will get the entire column. On later versions it will get the 4x4x4 cube's biome.
- Parameters:
position
- the (x, y, z) location to check the biome at- Returns:
- the biome at the location
- See Also:
-
toClipboard
-
setOrigin
Description copied from interface:Clipboard
Set the origin point from which the copy was made from.- Specified by:
setOrigin
in interfaceClipboard
- Overrides:
setOrigin
in classSimpleClipboard
- Parameters:
origin
- the origin
-
setOffset
- Overrides:
setOffset
in classSimpleClipboard
-
flush
public void flush()Description copied from interface:Clipboard
Flush the clipboard if appropriate. Only does something if using clipboard-on-disk. Blocking method and ensures all data is saved to disk for any further operation with the clipboard. -
close
public void close()Description copied from interface:Clipboard
Close the clipboard. May not allow further reading of the clipboard if saved on disk. -
getTileEntities
- Specified by:
getTileEntities
in classLinearClipboard
-
getIndex
public int getIndex(int x, int y, int z) -
getBiomeIndex
public int getBiomeIndex(int x, int y, int z) -
getFullBlock
-
getFullBlock
- Specified by:
getFullBlock
in classLinearClipboard
-
getBlock
- Specified by:
getBlock
in classLinearClipboard
-
getBlock
-
setTile
-
setBlock
-
setBlock
- Specified by:
setBlock
in classLinearClipboard
-
DiskOptimizedClipboard(Region, UUID)
orDiskOptimizedClipboard(BlockVector3, File)
to avoid creating a large number of clipboard files that won't be cleaned until `clipboard.delete-after-days` and a server restart.