Package dev.boze.api.utility.interaction
Class PlaceHelper
java.lang.Object
dev.boze.api.utility.interaction.PlaceHelper
PlaceHelper provides utilities for casting block placement interactions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.util.hit.BlockHitResultcast(net.minecraft.util.math.BlockPos pos, InteractionMode mode) Cast a block placement interaction at the specified positionstatic net.minecraft.util.hit.BlockHitResultcast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, boolean strictDirection) Cast a block placement interaction at the specified position with strict direction settingstatic net.minecraft.util.hit.BlockHitResultcast(net.minecraft.util.math.BlockPos pos, InteractionMode mode, double range, double wallsRange) Cast a block placement interaction at the specified position with custom rangestatic net.minecraft.util.hit.BlockHitResultcast(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 directionstatic booleanplace(InteractionMode mode, net.minecraft.util.hit.BlockHitResult hitResult, net.minecraft.util.Hand hand) Place a block at the specified hit result location
-
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 atmode- 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 rangeNote: range/wallsRange won't apply if interactionMode is GRIM
- Parameters:
pos- The position to cast atmode- The interaction mode to userange- The reach range to usewallsRange- 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 atmode- The interaction mode to usestrictDirection- 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 directionNote: range/wallsRange won't apply if interactionMode is GRIM
- Parameters:
pos- The position to cast atmode- The interaction mode to userange- The reach range to usewallsRange- 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 usehitResult- The block hit result from a cast operationhand- The hand to use for placement- Returns:
- true if placement was successful
-