Interface IBlockCapabilityProvider

All Known Implementing Classes:
BlockCapabilities

public interface IBlockCapabilityProvider
Equivalent of ICapabilityProvider for blocks that do not have an internal state. Register a provider at BlockCapabilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> net.minecraftforge.common.util.LazyOptional<T>
    getCapability(net.minecraft.world.level.block.state.BlockState blockState, net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction facing)
    Retrieves the handler for the capability of the given block requested at the given position.
  • Method Details

    • getCapability

      <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraft.world.level.block.state.BlockState blockState, @Nonnull net.minecraftforge.common.capabilities.Capability<T> capability, @Nonnull net.minecraft.world.level.BlockGetter world, @Nonnull net.minecraft.core.BlockPos pos, @Nullable net.minecraft.core.Direction facing)
      Retrieves the handler for the capability of the given block requested at the given position. The position is identified by the World, BlockPos and EnumFacing. The return value CAN be null if the block does not support the capability. The return value CAN be the same for multiple faces.
      Type Parameters:
      T - The capability type.
      Parameters:
      blockState - The blockstate to retrieve the capability from
      capability - The capability to check
      world - The world in which the given block exists
      pos - The position at which the given block exists
      facing - The Side to check from: CAN BE NULL. Null is defined to represent 'internal' or 'self'
      Returns:
      The requested capability.