BlockApiCache

public interface BlockApiCache<A, C>

A BlockApiLookup bound to a ServerWorld and a position, providing much faster API access. Refer to BlockApiLookup for example code.

This object caches the block entity at the target position, and the last used API provider, removing those queries. If a block entity is available or if the block state is passed as a parameter, the block state doesn't have to be looked up either.

See also

Parameters

<A>

The type of the API.

<C>

The type of the additional context object.

Functions

create
Link copied to clipboard
static BlockApiCache<A, Ccreate<A, C>(BlockApiLookup<A, C> lookup, ServerWorld world, BlockPos pos)
Create a new instance bound to the passed ServerWorld and position, and querying the same API as the passed lookup.
find
Link copied to clipboard
@Nullable()
A find(C context)
Attempt to retrieve an API from a block in the world, using the world and the position passed at creation time.
@Nullable()
abstract A find(@Nullable() BlockState state, C context)
Attempt to retrieve an API from a block in the world, using the world and the position passed at creation time.

Inheritors

BlockApiCacheImpl
Link copied to clipboard

Sources

jvm source
Link copied to clipboard