Interface IInteractions


public interface IInteractions
Interface for InteractionUtils
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.world.phys.BlockHitResult
    getBlockHitResult(net.minecraft.core.BlockPos blockPos, boolean strictDir, boolean raytrace, double maxRange)
    Calculates the best spot to reach a block
    @Nullable net.minecraft.world.phys.BlockHitResult
    getBlockPlaceHitResult(net.minecraft.core.BlockPos blockPos, boolean strictDir, boolean raytrace, double maxRange)
    Calculates the best relative block that we can place on to place a block at the given position
    boolean
    placeBlock(net.minecraft.core.BlockPos blockPos, net.minecraft.world.InteractionHand hand, boolean raytrace)
    Tries to place a block at the given position
    boolean
    useBlock(net.minecraft.core.BlockPos pos, net.minecraft.world.InteractionHand hand, boolean strictDir, boolean raytrace)
    Tries to right click a block
    boolean
    useBlock(net.minecraft.world.phys.BlockHitResult hitResult, net.minecraft.world.InteractionHand hand, boolean trySneaking)
    Right clicks a block
  • Method Details

    • placeBlock

      boolean placeBlock(net.minecraft.core.BlockPos blockPos, net.minecraft.world.InteractionHand hand, boolean raytrace)
      Tries to place a block at the given position
      Parameters:
      blockPos -
      hand -
      raytrace -
      Returns:
      false if unable to place a block at the given position
    • useBlock

      boolean useBlock(net.minecraft.core.BlockPos pos, net.minecraft.world.InteractionHand hand, boolean strictDir, boolean raytrace)
      Tries to right click a block
      Parameters:
      pos - the position of the block
      hand - the hand to use
      raytrace -
      Returns:
      false if unable to use the block
    • useBlock

      boolean useBlock(net.minecraft.world.phys.BlockHitResult hitResult, net.minecraft.world.InteractionHand hand, boolean trySneaking)
      Right clicks a block
      Parameters:
      hitResult - the hit result of the block
      hand - the hand to use
      trySneaking - should be true if you are trying to place a block
      Returns:
      true if the action was consumed
    • getBlockPlaceHitResult

      @Nullable @Nullable net.minecraft.world.phys.BlockHitResult getBlockPlaceHitResult(net.minecraft.core.BlockPos blockPos, boolean strictDir, boolean raytrace, double maxRange)
      Calculates the best relative block that we can place on to place a block at the given position
      Parameters:
      blockPos - The position we want to place the block
      Returns:
      The best hit result
    • getBlockHitResult

      @Nullable @Nullable net.minecraft.world.phys.BlockHitResult getBlockHitResult(net.minecraft.core.BlockPos blockPos, boolean strictDir, boolean raytrace, double maxRange)
      Calculates the best spot to reach a block
      Parameters:
      blockPos -
      raytrace -
      maxRange -
      Returns: