Class ThreadUnsafeCharBlocks
java.lang.Object
com.fastasyncworldedit.core.queue.implementation.blocks.ThreadUnsafeCharBlocks
- All Implemented Interfaces:
IBlocks
,IChunkSet
,Trimable
,OutputExtent
Equivalent to
CharSetBlocks
without any attempt to make thread-safe for improved performance.
This is currently only used as a "copy" of CharSetBlocks
to provide to
IBatchProcessor
instances for processing without overlapping the continuing edit.- Since:
- 2.6.2
-
Method Summary
Modifier and TypeMethodDescriptionCreate an entirely distinct copy of this SET instance.char
get
(int x, int y, int z) BiomeType[][]
This will return only biomes SET to the EXTENT or QUEUE.getBiomeType
(int x, int y, int z) int
getBlock
(int x, int y, int z) Map
<HeightMapType, int[]> char[][]
getLight()
int
Get the highest layer position stored in the internal chunk.int
Get the lowest layer position stored in the internal chunk.int
Get the number of stored sectionschar[][]
getTile
(int x, int y, int z) getTiles()
boolean
boolean
hasBiomes
(int layer) If the given layer has biomes stored to be set to the world.boolean
hasLight()
boolean
hasSection
(int layer) Returns if the chunk has a BLOCKS section at the given layer.boolean
isEmpty()
boolean
char[]
load
(int layer) Obtain the specified chunk section stored as an array of ordinals.@org.jetbrains.annotations.Nullable char[]
loadIfPresent
(int layer) Obtain the specified chunk section stored as an array of ordinals if present or null.void
removeEntity
(UUID uuid) void
removeSectionLighting
(int layer, boolean sky) reset()
void
set
(int x, int y, int z, char value) boolean
boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.void
setBitMask
(int bitMask) <T extends BlockStateHolder<T>>
booleansetBlock
(int x, int y, int z, T holder) void
setBlockLight
(int x, int y, int z, int value) void
setBlocks
(int layer, char[] data) void
setEntity
(CompoundTag tag) void
setFastMode
(boolean fastMode) void
setFullBright
(int layer) void
setHeightMap
(HeightMapType type, int[] heightMap) void
setLightLayer
(int layer, char[] toSet) void
setSkyLight
(int x, int y, int z, int value) void
setSkyLightLayer
(int layer, char[] toSet) boolean
setTile
(int x, int y, int z, CompoundTag tile) boolean
trim
(boolean aggressive) Trims the object, reducing its memory footprint.boolean
trim
(boolean aggressive, int layer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.fastasyncworldedit.core.queue.IBlocks
toByteArray, toByteArray
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBlock, setBlockLight, setSkyLight
-
Method Details
-
hasSection
public boolean hasSection(int layer) Description copied from interface:IBlocks
Returns if the chunk has a BLOCKS section at the given layer. May not be indicative of presence of entities, tile entites, biomes, etc.- Specified by:
hasSection
in interfaceIBlocks
- Parameters:
layer
- chunk section layer- Returns:
- if blocks/a block section is present
-
load
public char[] load(int layer) Description copied from interface:IBlocks
Obtain the specified chunk section stored as an array of ordinals. Uses normal minecraft chunk-section position indices (length 4096). Operations synchronises on the section and will load the section into memory if not present. For chunk GET operations, this will load the data from the world. For chunk SET, this will create a new empty array. -
loadIfPresent
@Nullable public @org.jetbrains.annotations.Nullable char[] loadIfPresent(int layer) Description copied from interface:IBlocks
Obtain the specified chunk section stored as an array of ordinals if present or null. Uses normal minecraft chunk-section position indices (length 4096). Does not synchronise to the section layer as it will not attempt to load into memory.- Specified by:
loadIfPresent
in interfaceIBlocks
- Parameters:
layer
- chunk section layer (may be negative)- Returns:
- char array of ordinals of the chunk section if present
-
getTiles
-
getTile
-
getEntities
- Specified by:
getEntities
in interfaceIBlocks
-
getHeightMaps
- Specified by:
getHeightMaps
in interfaceIChunkSet
-
removeSectionLighting
public void removeSectionLighting(int layer, boolean sky) - Specified by:
removeSectionLighting
in interfaceIBlocks
-
trim
public boolean trim(boolean aggressive, int layer) -
getSectionCount
public int getSectionCount()Description copied from interface:IBlocks
Get the number of stored sections- Specified by:
getSectionCount
in interfaceIBlocks
-
getMaxSectionPosition
public int getMaxSectionPosition()Description copied from interface:IBlocks
Get the highest layer position stored in the internal chunk. For 1.16 and below, always returns 15. For 1.17 and above, may not return a value correct to the world if this is aIChunkSet
instance, which defaults to 15. For extended height worlds, this will only return over 15 if blocks are stored outside the default range.- Specified by:
getMaxSectionPosition
in interfaceIBlocks
-
getMinSectionPosition
public int getMinSectionPosition()Description copied from interface:IBlocks
Get the lowest layer position stored in the internal chunk. For 1.16 and below, always returns 0. For 1.17 and above, may not return a value correct to the world if this is aIChunkSet
instance, which defaults to 0. For extended height worlds, this will only return under 0 if blocks are stored outside the default range.- Specified by:
getMinSectionPosition
in interfaceIBlocks
-
get
public char get(int x, int y, int z) -
getBiomeType
- Specified by:
getBiomeType
in interfaceIBlocks
-
getBlock
-
setBiome
- Specified by:
setBiome
in interfaceIChunkSet
- Specified by:
setBiome
in interfaceOutputExtent
-
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.
- Specified by:
setBiome
in interfaceIChunkSet
- Specified by:
setBiome
in interfaceOutputExtent
- 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)
-
set
public void set(int x, int y, int z, char value) -
setBlock
- Specified by:
setBlock
in interfaceIChunkSet
- Specified by:
setBlock
in interfaceOutputExtent
-
setBlocks
public void setBlocks(int layer, char[] data) -
isEmpty
public boolean isEmpty() -
setTile
- Specified by:
setTile
in interfaceIChunkSet
- Specified by:
setTile
in interfaceOutputExtent
-
setBlockLight
public void setBlockLight(int x, int y, int z, int value) - Specified by:
setBlockLight
in interfaceIChunkSet
- Specified by:
setBlockLight
in interfaceOutputExtent
-
setSkyLight
public void setSkyLight(int x, int y, int z, int value) - Specified by:
setSkyLight
in interfaceIChunkSet
- Specified by:
setSkyLight
in interfaceOutputExtent
-
setHeightMap
- Specified by:
setHeightMap
in interfaceIChunkSet
- Specified by:
setHeightMap
in interfaceOutputExtent
-
setLightLayer
public void setLightLayer(int layer, char[] toSet) - Specified by:
setLightLayer
in interfaceIChunkSet
-
setSkyLightLayer
public void setSkyLightLayer(int layer, char[] toSet) - Specified by:
setSkyLightLayer
in interfaceIChunkSet
-
setFullBright
public void setFullBright(int layer) - Specified by:
setFullBright
in interfaceIChunkSet
-
setEntity
-
removeEntity
- Specified by:
removeEntity
in interfaceIChunkSet
-
setFastMode
public void setFastMode(boolean fastMode) - Specified by:
setFastMode
in interfaceIChunkSet
-
isFastMode
public boolean isFastMode()- Specified by:
isFastMode
in interfaceIChunkSet
-
setBitMask
public void setBitMask(int bitMask) - Specified by:
setBitMask
in interfaceIChunkSet
-
getBitMask
public int getBitMask()- Specified by:
getBitMask
in interfaceIBlocks
- Specified by:
getBitMask
in interfaceIChunkSet
-
getEntityRemoves
- Specified by:
getEntityRemoves
in interfaceIChunkSet
-
getBiomes
Description copied from interface:IChunkSet
This will return only biomes SET to the EXTENT or QUEUE. This will NOT return the current biomes in the world. This is used for history purposes. -
hasBiomes
public boolean hasBiomes() -
getLight
public char[][] getLight() -
getSkyLight
public char[][] getSkyLight()- Specified by:
getSkyLight
in interfaceIChunkSet
-
hasLight
public boolean hasLight() -
reset
-
hasBiomes
public boolean hasBiomes(int layer) Description copied from interface:IChunkSet
If the given layer has biomes stored to be set to the world. Can be negative -
createCopy
Description copied from interface:IChunkSet
Create an entirely distinct copy of this SET instance. All mutable data must be copied to sufficiently prevent leakage between the copy and the original.- Specified by:
createCopy
in interfaceIChunkSet
- Returns:
- distinct new
instance
-
trim
public boolean trim(boolean aggressive) Description copied from interface:Trimable
Trims the object, reducing its memory footprint.
-