Class PlaceHelper

java.lang.Object
dev.boze.api.utility.interaction.PlaceHelper

public class PlaceHelper extends Object
PlaceHelper provides utilities for casting block placement interactions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.util.hit.BlockHitResult
    cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode)
    Cast a block placement interaction at the specified position
    static net.minecraft.util.hit.BlockHitResult
    cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, boolean strictDirection)
    Cast a block placement interaction at the specified position with strict direction setting
    static net.minecraft.util.hit.BlockHitResult
    cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, double range, double wallsRange)
    Cast a block placement interaction at the specified position with custom range
    static net.minecraft.util.hit.BlockHitResult
    cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, double range, double wallsRange, boolean strictDirection)
    Cast a block placement interaction at the specified position with custom range and strict direction
    static boolean
    place(InteractionMode mode, net.minecraft.util.hit.BlockHitResult hitResult, net.minecraft.util.Hand hand)
    Place a block at the specified hit result location

    Methods inherited from class java.lang.Object

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

    • PlaceHelper

      public PlaceHelper()
  • Method Details

    • cast

      public static net.minecraft.util.hit.BlockHitResult cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode)
      Cast a block placement interaction at the specified position
      Parameters:
      pos - The position to cast at
      mode - The interaction mode to use
      Returns:
      The block hit result, or null if no valid placement found
    • cast

      public static net.minecraft.util.hit.BlockHitResult cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, double range, double wallsRange)
      Cast a block placement interaction at the specified position with custom range

      Note: range/wallsRange won't apply if interactionMode is GRIM

      Parameters:
      pos - The position to cast at
      mode - The interaction mode to use
      range - The reach range to use
      wallsRange - The walls reach range to use (only applies if mode is NCP)
      Returns:
      The block hit result, or null if no valid placement found
    • cast

      public static net.minecraft.util.hit.BlockHitResult cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, boolean strictDirection)
      Cast a block placement interaction at the specified position with strict direction setting
      Parameters:
      pos - The position to cast at
      mode - The interaction mode to use
      strictDirection - Whether to use strict direction checking
      Returns:
      The block hit result, or null if no valid placement found
    • cast

      public static net.minecraft.util.hit.BlockHitResult cast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, double range, double wallsRange, boolean strictDirection)
      Cast a block placement interaction at the specified position with custom range and strict direction

      Note: range/wallsRange won't apply if interactionMode is GRIM

      Parameters:
      pos - The position to cast at
      mode - The interaction mode to use
      range - The reach range to use
      wallsRange - The walls reach range to use (only applies if mode is NCP)
      strictDirection - Whether to use strict direction checking
      Returns:
      The block hit result, or null if no valid placement found
    • place

      public static boolean place(InteractionMode mode, net.minecraft.util.hit.BlockHitResult hitResult, net.minecraft.util.Hand hand)
      Place a block at the specified hit result location
      Parameters:
      mode - The interaction mode to use
      hitResult - The block hit result from a cast operation
      hand - The hand to use for placement
      Returns:
      true if placement was successful