java.lang.Object
net.paulem.arcana.regions.container.ChunkSectionBlockContainer<S,K>
- Type Parameters:
S- The type of entities being tracked and managed, which extendsTracked.K- The type of the key associated with the tracked entities, which extendsWorldKey.
- All Implemented Interfaces:
SubContainerHolderAccessor<S,K>
public class ChunkSectionBlockContainer<S extends Tracked<K>,K extends WorldKey>
extends Object
implements SubContainerHolderAccessor<S,K>
Represents a container for managing blocks within a specific vertical section of a chunk.
Each ChunkSectionBlockContainer instance corresponds to a single section, providing management
for tracked entities within that section. This container is optimized for organizing and accessing
data based on three-dimensional coordinates (x, y, z) relative to the chunk section.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes every holder stored in this section.Collection<Holder<S, K>> getHolder(int x, int y, int z) Retrieves the tracked object at the given coordinates, relative to this section.static <S extends Tracked<K>,K extends WorldKey>
ChunkSectionBlockContainer<S, K> of(ChunkBlockContainer<S, K> parent, int sectionY) Creates a new, emptyChunkSectionBlockContainerfor the given parent chunk container and section index.voidremoveHolder(int x, int y, int z) Removes the tracked object at the given coordinates, relative to this section, and notifies the parent chunk container to remove this section if it has become empty as a result.voidStores a tracked object at the given coordinates, relative to this section.
-
Method Details
-
of
public static <S extends Tracked<K>,K extends WorldKey> ChunkSectionBlockContainer<S,K> of(ChunkBlockContainer<S, K> parent, int sectionY) Creates a new, emptyChunkSectionBlockContainerfor the given parent chunk container and section index.- Type Parameters:
S- the type of the tracked entities being managedK- the type of the key associated with the tracked entities- Parameters:
parent- the chunk container this section belongs tosectionY- the vertical index of this section within the chunk- Returns:
- a new
ChunkSectionBlockContainerinstance
-
getHolder
Retrieves the tracked object at the given coordinates, relative to this section. -
setHolder
Stores a tracked object at the given coordinates, relative to this section. -
removeHolder
public void removeHolder(int x, int y, int z) Removes the tracked object at the given coordinates, relative to this section, and notifies the parent chunk container to remove this section if it has become empty as a result.- Specified by:
removeHolderin interfaceSubContainerHolderAccessor<S extends Tracked<K>,K extends WorldKey> - Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
clear
public void clear()Removes every holder stored in this section. -
getAllHolders
- Specified by:
getAllHoldersin interfaceSubContainerHolderAccessor<S extends Tracked<K>,K extends WorldKey> - Returns:
- a collection of all holders currently stored in this section
-