Class BlockCapabilitiesHelpers
java.lang.Object
org.cyclops.cyclopscore.modcompat.commoncapabilities.BlockCapabilitiesHelpers
Several helpers for combining block and tile capabilities.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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.
-
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.
-