Interface ILevelExtension
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Prefix used for all dimension based translations -
Method Summary
Modifier and TypeMethodDescriptiondefault <T,
C extends @Nullable Object>
TgetCapability
(BlockCapability<T, C> cap, net.minecraft.core.BlockPos pos, C context) Retrieve a block capability.default <T,
C extends @Nullable Object>
TgetCapability
(BlockCapability<T, C> cap, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, C context) Retrieve a block capability.default <T> T
getCapability
(BlockCapability<T, @Nullable Void> cap, net.minecraft.core.BlockPos pos) Retrieve a block capability with no context.default <T> T
getCapability
(BlockCapability<T, @Nullable Void> cap, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) Retrieve a block capability with no context.default net.minecraft.network.chat.Component
Returns Component which looks up the matching value for getDescriptionKey(), falling back to the registry name if no translation exists.default String
Returns the translation key for this dimension.double
The maximum radius to scan for entities when trying to check bounding boxes.default @Nullable ModelDataManager
Retrieves the model data manager for the given level.double
increaseMaxEntityRadius
(double value) Increases the max entity radius, this is safe to call with any value.default void
invalidateCapabilities
(net.minecraft.core.BlockPos pos) Notify all listeners that the capabilities at a specific position might have changed.default void
invalidateCapabilities
(net.minecraft.world.level.ChunkPos pos) Notify all listeners that the capabilities at all the positions in a chunk might have changed.private net.minecraft.world.level.Level
self()
-
Field Details
-
TRANSLATION_PREFIX
Prefix used for all dimension based translationsAll dimension translations must start with this prefix, followed by the registry namespace and path.
dimension.<namespace>.<path>
- See Also:
-
-
Method Details
-
self
private net.minecraft.world.level.Level self() -
getMaxEntityRadius
double getMaxEntityRadius()The maximum radius to scan for entities when trying to check bounding boxes. Vanilla's default is 2.0D But mods that add larger entities may increase this. -
increaseMaxEntityRadius
double increaseMaxEntityRadius(double value) Increases the max entity radius, this is safe to call with any value. The setter will verify the input value is larger then the current setting.- Parameters:
value
- New max radius to set.- Returns:
- The new max radius
-
getModelDataManager
Retrieves the model data manager for the given level. May be null on a server level.For model data retrieval, prefer calling
IBlockGetterExtension.getModelData(BlockPos)
rather than this method, as it works on more than just a level. -
getCapability
@Nullable default <T,C extends @Nullable Object> T getCapability(BlockCapability<T, C> cap, net.minecraft.core.BlockPos pos, C context) Retrieve a block capability.If the block state and/or the block entity is known, pass them via
getCapability(BlockCapability, BlockPos, BlockState, BlockEntity, Object)
instead. -
getCapability
@Nullable default <T,C extends @Nullable Object> T getCapability(BlockCapability<T, C> cap, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, C context) Retrieve a block capability.Use this override if the block state and/or the block entity is known, otherwise prefer the shorter
getCapability(BlockCapability, BlockPos, Object)
.If either the block state or the block entity is unknown, simply pass
null
. This function will fetchnull
parameters from the level, with some extra checks to attempt to skip unnecessary fetches.- Parameters:
state
- the block state, if known, ornull
if unknownblockEntity
- the block entity, if known, ornull
if unknown
-
getCapability
@Nullable default <T> T getCapability(BlockCapability<T, @Nullable Void> cap, net.minecraft.core.BlockPos pos) Retrieve a block capability with no context.If the block state and/or the block entity is known, pass them via
getCapability(BlockCapability, BlockPos, BlockState, BlockEntity)
instead. -
getCapability
@Nullable default <T> T getCapability(BlockCapability<T, @Nullable Void> cap, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) Retrieve a block capability with no context.Use this override if the block state and/or the block entity is known, otherwise prefer the shorter
getCapability(BlockCapability, BlockPos)
.If either the block state or the block entity is unknown, simply pass
null
. This function will fetchnull
parameters from the level, with some extra checks to attempt to skip unnecessary fetches.- Parameters:
state
- the block state, if known, ornull
if unknownblockEntity
- the block entity, if known, ornull
if unknown
-
invalidateCapabilities
default void invalidateCapabilities(net.minecraft.core.BlockPos pos) Notify all listeners that the capabilities at a specific position might have changed. This includes new capabilities becoming available.This method will only do something on
ServerLevel
s, but it is safe to call on anyLevel
, without the need for aninstanceof
check.If you already have a block entity at that position, you can call
IBlockEntityExtension.invalidateCapabilities()
instead. -
invalidateCapabilities
default void invalidateCapabilities(net.minecraft.world.level.ChunkPos pos) Notify all listeners that the capabilities at all the positions in a chunk might have changed. This includes new capabilities becoming available.This method will only do something on
ServerLevel
s, but it is safe to call on anyLevel
, without the need for aninstanceof
check. -
getDescriptionKey
Returns the translation key for this dimension.Used when looking up the matching translation.
- Returns:
- Translation key used to lookup translation for this dimension.
- See Also:
-
getDescription
default net.minecraft.network.chat.Component getDescription()Returns Component which looks up the matching value for getDescriptionKey(), falling back to the registry name if no translation exists.- Returns:
- Translated name or registry name if none exists.
- See Also:
-