public class LastAccessExtentCache extends AbstractDelegateExtent
BaseBlock
for repeated calls to
getLazyBlock(Vector)
with the same position.Constructor and Description |
---|
LastAccessExtentCache(Extent extent)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
BaseBlock |
getLazyBlock(Vector position)
Get a lazy, immutable snapshot of the block at the given location that only
immediately contains information about the block's type (and metadata).
|
commit, commitBefore, createEntity, getBiome, getBlock, getEntities, getEntities, getExtent, getMaximumPoint, getMinimumPoint, setBiome, setBlock
public LastAccessExtentCache(Extent extent)
extent
- the extentpublic BaseBlock getLazyBlock(Vector position)
InputExtent
Further information (such as NBT data) will be available by the time of access. Therefore, it is not recommended that this method is used if the world is being simulated at the time of call. If the block needs to be stored for future use, then this method should definitely not be used. Moreover, the block that is returned is immutable (or should be), and therefore modifications should not be attempted on it. If a modifiable copy is required, then the block should be cloned.
This method exists because it is sometimes important to inspect the block
at a given location, but InputExtent.getBlock(Vector)
may be too expensive in
the underlying implementation. It is also not possible to implement
caching if the returned object is mutable, so this methods allows caching
implementations to be used.
getLazyBlock
in interface InputExtent
getLazyBlock
in class AbstractDelegateExtent
position
- position of the block