Interface IBlockHooks


public interface IBlockHooks
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.core.Direction[]
     
    static final net.minecraft.core.Direction[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable net.minecraft.world.level.pathfinder.PathType
    getPathfindingType(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter context, net.minecraft.core.BlockPos pos)
    Allows the block to determine its own pathfinding type.
    default void
    onLightningStrike(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LightningBolt lightning)
    Called when the block is directly struck by lightning.
    default void
    onLightningStrikeIndirect(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LightningBolt lightning, net.minecraft.core.BlockPos strikeOrigin)
    Called when a neighbor is struck by lightning and the block is not insulated from the strike.
    default net.minecraft.core.Direction[]
    redirectLightningStrike(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
    Provides an array of directions lightning can travel and indirectly hit when this block is hit by lightning.
  • Field Details

    • LIGHTNING_REDIRECTION_FACES

      static final net.minecraft.core.Direction[] LIGHTNING_REDIRECTION_FACES
    • NO_LIGHTNING_REDIRECTION_FACES

      static final net.minecraft.core.Direction[] NO_LIGHTNING_REDIRECTION_FACES
  • Method Details

    • getPathfindingType

      @Nullable default @Nullable net.minecraft.world.level.pathfinder.PathType getPathfindingType(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter context, net.minecraft.core.BlockPos pos)
      Allows the block to determine its own pathfinding type.
      Parameters:
      state - The current state of the block.
      context - Additional context from the world the block is in.
      pos - The position of the block.
      Returns:
      The pathfinding type for the block. If null is returned the vanilla behavior for determining pathfinding will be used instead.
    • onLightningStrike

      default void onLightningStrike(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LightningBolt lightning)
      Called when the block is directly struck by lightning.
      Parameters:
      state - The state of this block.
      level - The level.
      pos - The position of this block.
      lightning - The lightning bolt that hit the block.
    • onLightningStrikeIndirect

      default void onLightningStrikeIndirect(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LightningBolt lightning, net.minecraft.core.BlockPos strikeOrigin)
      Called when a neighbor is struck by lightning and the block is not insulated from the strike.
      Parameters:
      state - The state of this block.
      level - The level.
      pos - The position of this block.
      lightning - The lightning bolt that hit the block.
      strikeOrigin - The original strike position of the lightning bolt.
    • redirectLightningStrike

      default net.minecraft.core.Direction[] redirectLightningStrike(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
      Provides an array of directions lightning can travel and indirectly hit when this block is hit by lightning.
      Parameters:
      state - The state of this block.
      level - The level.
      pos - The position of this block.
      Returns:
      An array of directions that should be indirectly hit by the lightning.