Interface ImmersiveLogicHelpers

All Known Subinterfaces:
ImmersiveClientLogicHelpers
All Known Implementing Classes:
ImmersiveClientLogicHelpersImpl, ImmersiveLogicHelpersImpl

public interface ImmersiveLogicHelpers
Contains helpful methods that ensure the ImmersiveMC "style" is kept throughout API-implementors that wish to implement it, while also making the life of API-implementors easier.
These functions may be useful on the client and/or the server.
  • 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.
  • Method Details

    • instance

      static ImmersiveLogicHelpers instance()
      Returns:
      An ImmersiveLogicHelpers instance to access API functions. All details of this object not mentioned in this file are assumed to be an implementation detail, and may change at any time.
    • getHorizontalBlockForward

      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. 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.
      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

      SwapResult 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.
      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.