Interface FabricBlockState


public interface FabricBlockState
General-purpose Fabric-provided extensions for BlockState, matching the functionality provided in FabricBlock.

Note: This interface is automatically implemented on all block states via Mixin and interface injection.

  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.level.block.state.BlockState
    getAppearance(net.minecraft.world.level.BlockAndLightGetter level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable net.minecraft.world.level.block.state.BlockState sourceState, @Nullable net.minecraft.core.BlockPos sourcePos)
    Return the current appearance of the block, i.e.
    default float
    getProvidedEnchantmentPower(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    Return a for custom enchantment power level.
  • Method Details

    • getAppearance

      default net.minecraft.world.level.block.state.BlockState getAppearance(net.minecraft.world.level.BlockAndLightGetter level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable net.minecraft.world.level.block.state.BlockState sourceState, @Nullable net.minecraft.core.BlockPos sourcePos)
      Return the current appearance of the block, i.e. which block state this block reports to look like on a given side.
      Parameters:
      level - the level this block is in
      pos - position of this block, whose appearance is being queried
      side - the side for which the appearance is being queried
      sourceState - (optional) state of the block that is querying the appearance, or null if unknown
      sourcePos - (optional) position of the block that is querying the appearance, or null if unknown
      Returns:
      the appearance of the block on the given side; the original state can be returned if there is no better option
      See Also:
    • getProvidedEnchantmentPower

      default float getProvidedEnchantmentPower(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
      Return a for custom enchantment power level. A value of 1.0f means that the state is equivalent to one bookshelf.

      Important: Your block must be in BlockTags.ENCHANTMENT_POWER_PROVIDER to affect enchanting.

      Returning negative values is allowed and will decrease the enchantment power

      Note: Fractional powers are summed and then rounded to the nearest integer, with 0.5 rounding down.

      Parameters:
      level - the level this block is in
      pos - position of this block, whose power is being queried
      Returns:
      the bookshelf equivalent for this state