Class ImmersiveLogicHelpersImpl

java.lang.Object
com.hammy275.immersivemc.common.api_impl.ImmersiveLogicHelpersImpl
All Implemented Interfaces:
ImmersiveLogicHelpers
Direct Known Subclasses:
ImmersiveClientLogicHelpersImpl

public class ImmersiveLogicHelpersImpl extends Object implements ImmersiveLogicHelpers
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.core.Direction
    getHorizontalBlockForward(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos blockPos)
    Given a player and the position of an immersive block, returns the best direction the block should face to be looking towards the player.
    swapItems(net.minecraft.world.item.ItemStack stackFromPlayer, net.minecraft.world.item.ItemStack stackInImmersive, ItemSwapAmount swapAmount)
    Gets the result of a swap action between a player and an Immersive where the player may place items into and take items out of a slot, such as the input slots of a furnace.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ImmersiveLogicHelpersImpl

      public ImmersiveLogicHelpersImpl()
  • Method Details

    • getHorizontalBlockForward

      public net.minecraft.core.Direction getHorizontalBlockForward(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos blockPos)
      Description copied from interface: ImmersiveLogicHelpers
      Given a player and the position of an immersive block, returns the best direction the block should face to be looking towards the player. This is most commonly used for blocks like the crafting table which don't face a direction to come up with a good estimation. This method will always return NORTH, EAST, SOUTH, or WEST.
      Specified by:
      getHorizontalBlockForward in interface ImmersiveLogicHelpers
      Parameters:
      player - The player
      blockPos - The block to determine the facing direction of.
      Returns:
      A direction the block is facing, excluding UP and DOWN.
    • swapItems

      public SwapResult swapItems(net.minecraft.world.item.ItemStack stackFromPlayer, net.minecraft.world.item.ItemStack stackInImmersive, ItemSwapAmount swapAmount)
      Description copied from interface: ImmersiveLogicHelpers
      Gets the result of a swap action between a player and an Immersive where the player may place items into and take items out of a slot, such as the input slots of a furnace.
      Specified by:
      swapItems in interface ImmersiveLogicHelpers
      Parameters:
      stackFromPlayer - The ItemStack currently in the player's hand.
      stackInImmersive - The ItemStack currently in the slot of the Immersive the player is interacting with.
      swapAmount - The ItemSwapAmount that is determining the settings for how many items to swap.
      Returns:
      A SwapResult containing the ItemStacks that should be placed in the player's hand, be placed into the slot of the Immersive being interacted with, and the leftovers that should be given to the player some other way.