Class BlockCapabilitiesHelpers

java.lang.Object
org.cyclops.cyclopscore.modcompat.commoncapabilities.BlockCapabilitiesHelpers

public class BlockCapabilitiesHelpers extends Object
Several helpers for combining block and tile capabilities.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <C> net.minecraftforge.common.util.LazyOptional<C>
    getTileOrBlockCapability(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, net.minecraftforge.common.capabilities.Capability<C> capability)
    Safely get a capability from a tile or block.
    static <C> net.minecraftforge.common.util.LazyOptional<C>
    getTileOrBlockCapability(DimPos dimPos, net.minecraft.core.Direction side, net.minecraftforge.common.capabilities.Capability<C> capability)
    Safely get a capability from a tile or block.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlockCapabilitiesHelpers

      public BlockCapabilitiesHelpers()
  • Method Details

    • getTileOrBlockCapability

      public static <C> net.minecraftforge.common.util.LazyOptional<C> getTileOrBlockCapability(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, net.minecraftforge.common.capabilities.Capability<C> capability)
      Safely get a capability from a tile or block. The capability of the tile will be checked first, only if it was not found, the block will be checked.
      Type Parameters:
      C - The capability instance.
      Parameters:
      world - The world.
      pos - The position of the tile or block providing the capability.
      side - The side to get the capability from.
      capability - The capability.
      Returns:
      The lazy optional capability.
    • getTileOrBlockCapability

      public static <C> net.minecraftforge.common.util.LazyOptional<C> getTileOrBlockCapability(DimPos dimPos, net.minecraft.core.Direction side, net.minecraftforge.common.capabilities.Capability<C> capability)
      Safely get a capability from a tile or block. The capability of the tile will be checked first, only if it was not found, the block will be checked.
      Type Parameters:
      C - The capability instance.
      Parameters:
      dimPos - The world and position.
      side - The side to get the capability from.
      capability - The capability.
      Returns:
      The lazy optional capability.