Interface ImmersiveInfo

All Known Subinterfaces:
BuiltImmersiveInfo<E>
All Known Implementing Classes:
AbstractImmersiveInfo, BeaconInfo, BuiltImmersiveInfoImpl, ChestInfo, DragImmersiveInfo, LecternInfo

public interface ImmersiveInfo
ImmersiveInfo's are effectively containers of data for Immersives. For example, with the furnace, there is one Immersive instance, which declares how to handle rendering furnaces, interacting with hitboxes, etc. Meanwhile, an ImmersiveInfo instance exists for each furnace that is being rendered in the world, containing data such as what item it contains, where in the world that furnace is, etc.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<? extends HitboxInfo>
     
    net.minecraft.core.BlockPos
    Gets the block position of the block this ImmersiveInfo represents.
    int
    getSlotHovered(int handIndex)
     
    long
     
    boolean
    Whether this ImmersiveInfo contains valid hitboxes that are ready for use by users in-game.
    void
    setSlotHovered(int hitboxIndex, int handIndex)
    A notification to mark the given slot as hovered by the given hand index.
  • Method Details

    • getAllHitboxes

      List<? extends HitboxInfo> getAllHitboxes()
      Returns:
      The list of all hitboxes this Immersive uses. This can contain null elements, and can return an immutable list implementation if desired.
    • hasHitboxes

      boolean hasHitboxes()
      Whether this ImmersiveInfo contains valid hitboxes that are ready for use by users in-game. getAllHitboxes() will not be called if this method returns false for a given tick.
      Returns:
      Whether getAllHitboxes() can be safely called and contains expected data.
    • getBlockPosition

      net.minecraft.core.BlockPos getBlockPosition()
      Gets the block position of the block this ImmersiveInfo represents. This function should always return the same value for an individual ImmersiveInfo instance, and this function may be called after the block at this position no longer matches the Immersive it represents.
      For example, if this ImmersiveInfo was used to represent a furnace that was initially placed at x=1, y=2, and z=3, this function should always return the position x=1, y=2, and z=3, even after the furnace is destroyed or replaced by some other block.
      Returns:
      The position of the block this ImmersiveInfo represents.
    • setSlotHovered

      void setSlotHovered(int hitboxIndex, int handIndex)
      A notification to mark the given slot as hovered by the given hand index.
      Parameters:
      hitboxIndex - The index into getAllHitboxes() to mark as hovered, or -1 to indicate no slot is hovered by this hand.
      handIndex - 0 for the primary hand (primary controller in VR or the player hand in non-VR), and 1 for the secondary hand (secondary controller in VR, or nothing in non-VR).
    • getSlotHovered

      int getSlotHovered(int handIndex)
      Parameters:
      handIndex - The hand that is checking for a hovered hitbox.
      Returns:
      The hitbox the handIndex is hovering, or -1 if it isn't hovering any slot.
    • getTicksExisted

      long getTicksExisted()
      Returns:
      The number of ticks this info has existed for.