AbstractBlockLocationTracker

Tracks locations of specific states in the world.

Parameters

T

state type

Inheritors

Types

Link copied to clipboard

This base implementation stores BlockPos and state T one by one.

Link copied to clipboard

This base implementation stores multiple BlockPos for each state T.

Properties

Link copied to clipboard
open val debugName: String
Link copied to clipboard

If this is true recordBlock is called on chunk updates and on single block updates. This might be inefficient for some modules, so they can choose to not call that method on chunk updates.

Functions

Link copied to clipboard
abstract fun allPositions(): Sequence<BlockPos>

Returns a Sequence providing all tracked BlockPos.

Link copied to clipboard
override fun chunkUpdate(chunk: LevelChunk)

Is called when a chunk is initially loaded or entirely updated.

Link copied to clipboard
abstract fun clearAllChunks()
Link copied to clipboard
abstract fun clearChunk(pos: ChunkPos)
Link copied to clipboard
abstract fun getStateFor(pos: BlockPos, state: BlockState): T?

Gets the state of specified BlockPos and its BlockState.

Link copied to clipboard
abstract fun isEmpty(): Boolean

Returns if there iss nothing tracked.

Link copied to clipboard
abstract fun iterate(): Sequence<Map.Entry<BlockPos, T>>

Returns a Sequence providing all tracked BlockPos and its state T.

Link copied to clipboard
open fun onUpdated()
Link copied to clipboard
override fun recordBlock(pos: BlockPos, state: BlockState, cleared: Boolean)

Registers a block update and asks the subscriber to make a decision about what should be done. This method must be thread-safe.

Link copied to clipboard
abstract fun track(pos: BlockPos, state: T)

Tracks a BlockPos with state.

Link copied to clipboard
abstract fun untrack(pos: BlockPos): Boolean

Untracks a BlockPos.