Interface IPlacementHelper

All Known Implementing Classes:
CogwheelBlockItem.DiagonalCogHelper, CogwheelBlockItem.IntegratedLargeCogHelper, CogwheelBlockItem.IntegratedSmallCogHelper, GantryShaftBlock.PlacementHelper, GirderPlacementHelper, PistonExtensionPoleBlock.PlacementHelper, PoleHelper

public interface IPlacementHelper
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.world.level.block.state.BlockState
    used as an identifier in SuperGlueHandler to skip blocks placed by helpers
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
     
    Predicate<net.minecraft.world.item.ItemStack>
     
    getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray)
     
    getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray, net.minecraft.world.item.ItemStack heldItem)
     
    Predicate<net.minecraft.world.level.block.state.BlockState>
     
    default boolean
    matchesItem(net.minecraft.world.item.ItemStack item)
     
    default boolean
    matchesState(net.minecraft.world.level.block.state.BlockState state)
     
    static List<net.minecraft.core.Direction>
    orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit)
     
    static List<net.minecraft.core.Direction>
    orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, Collection<net.minecraft.core.Direction> directions)
     
    static List<net.minecraft.core.Direction>
    orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, Predicate<net.minecraft.core.Direction> includeDirection)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second, Predicate<net.minecraft.core.Direction> includeDirection)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis)
     
    static List<net.minecraft.core.Direction>
    orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection)
     
    static void
    renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane)
     
    static void
    renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane, double distanceFromCenter)
     
    default void
    renderAt(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.phys.BlockHitResult ray, PlacementOffset offset)
    overwrite this method if your placement helper needs a different rendering than the default ghost state
  • Field Details

    • ID

      static final net.minecraft.world.level.block.state.BlockState ID
      used as an identifier in SuperGlueHandler to skip blocks placed by helpers
  • Method Details

    • getItemPredicate

      Predicate<net.minecraft.world.item.ItemStack> getItemPredicate()
      Returns:
      a predicate that gets tested with the items held in the players hands
      should return true if this placement helper is active with the given item
    • getStatePredicate

      Predicate<net.minecraft.world.level.block.state.BlockState> getStatePredicate()
      Returns:
      a predicate that gets tested with the blockstate the player is looking at
      should return true if this placement helper is active with the given blockstate
    • getOffset

      PlacementOffset getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray)
      Parameters:
      player - the player that activated the placement helper
      world - the world that the placement helper got activated in
      state - the Blockstate of the Block that the player is looking at or clicked on
      pos - the position of the Block the player is looking at or clicked on
      ray - the exact raytrace result
      Returns:
      the PlacementOffset object describing where to place the new block.
      Use PlacementOffset.fail() when no new position could be found.
      Use PlacementOffset.success(Vec3i) with the new BlockPos to indicate a success and call PlacementOffset.withTransform(Function) if the blocks default state has to be modified before it is placed
    • getOffset

      default PlacementOffset getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray, net.minecraft.world.item.ItemStack heldItem)
    • renderAt

      default void renderAt(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.phys.BlockHitResult ray, PlacementOffset offset)
      overwrite this method if your placement helper needs a different rendering than the default ghost state
      Parameters:
      pos - the position of the Block the player is looking at or clicked on
      state - the Blockstate of the Block that the player is looking at or clicked on
      ray - the exact raytrace result
      offset - the PlacementOffset returned by getOffset(Player, Level, BlockState, BlockPos, BlockHitResult)
      the offset will always be successful if this method is called
    • renderArrow

      static void renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane)
    • renderArrow

      static void renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane, double distanceFromCenter)
    • displayGhost

      default void displayGhost(PlacementOffset offset)
    • orderedByDistanceOnlyAxis

      static List<net.minecraft.core.Direction> orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis)
    • orderedByDistanceOnlyAxis

      static List<net.minecraft.core.Direction> orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection)
    • orderedByDistanceExceptAxis

      static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis)
    • orderedByDistanceExceptAxis

      static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection)
    • orderedByDistanceExceptAxis

      static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second)
    • orderedByDistanceExceptAxis

      static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second, Predicate<net.minecraft.core.Direction> includeDirection)
    • orderedByDistance

      static List<net.minecraft.core.Direction> orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit)
    • orderedByDistance

      static List<net.minecraft.core.Direction> orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, Predicate<net.minecraft.core.Direction> includeDirection)
    • orderedByDistance

      static List<net.minecraft.core.Direction> orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, Collection<net.minecraft.core.Direction> directions)
    • matchesItem

      default boolean matchesItem(net.minecraft.world.item.ItemStack item)
    • matchesState

      default boolean matchesState(net.minecraft.world.level.block.state.BlockState state)