Class CharBlocks
java.lang.Object
com.fastasyncworldedit.core.queue.implementation.blocks.CharBlocks
- Direct Known Subclasses:
CharGetBlocks
,CharSetBlocks
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionchar[][]
protected final CharBlocks.Section
protected static final CharBlocks.Section
protected int
protected int
protected int
Object[]
-
Constructor Summary
ConstructorDescriptionCharBlocks
(int minSectionPosition, int maxSectionPosition) New instance given initial min/max section indices. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract char
Default char value to be used when "updating"/resetting data arraysfinal char
get
(int layer, int index) char
get
(int x, int y, int z) getBlock
(int x, int y, int z) 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 sectionsboolean
hasSection
(int layer) Returns if the chunk has a BLOCKS section at the given layer.char[]
load
(int layer) Obtain the specified chunk section stored as an array of ordinals.char[]
loadIfPresent
(int layer) Obtain the specified chunk section stored as an array of ordinals if present or null.reset()
void
reset
(int layer) final void
set
(int layer, int index, char value) void
set
(int x, int y, int z, char value) boolean
trim
(boolean aggressive) Trims the object, reducing its memory footprint.boolean
trim
(boolean aggressive, int layer) char[]
update
(int layer, char[] data, boolean aggressive) 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
getBiomeType, getBitMask, getEntities, getTile, getTiles, removeSectionLighting, toByteArray, toByteArray
-
Field Details
-
FULL
-
empty
-
blocks
public char[][] blocks -
sections
-
sectionLocks
-
minSectionPosition
protected int minSectionPosition -
maxSectionPosition
protected int maxSectionPosition -
sectionCount
protected int sectionCount
-
-
Constructor Details
-
CharBlocks
public CharBlocks(int minSectionPosition, int maxSectionPosition) New instance given initial min/max section indices. Can be negative.
-
-
Method Details
-
trim
public boolean trim(boolean aggressive) Description copied from interface:Trimable
Trims the object, reducing its memory footprint. -
trim
public boolean trim(boolean aggressive, int layer) -
reset
-
reset
public void reset(int layer) -
update
public char[] update(int layer, char[] data, boolean aggressive) -
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 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
-
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
-
getBlock
-
get
public char get(int x, int y, int z) -
defaultOrdinal
protected abstract char defaultOrdinal()Default char value to be used when "updating"/resetting data arrays -
set
public void set(int x, int y, int z, char value) -
get
public final char get(int layer, int index) -
set
- Throws:
ArrayIndexOutOfBoundsException
-