Enum Class HitboxPositioningMode

java.lang.Object
java.lang.Enum<HitboxPositioningMode>
com.hammy275.immersivemc.api.client.immersive.HitboxPositioningMode
All Implemented Interfaces:
Serializable, Comparable<HitboxPositioningMode>, Constable

public enum HitboxPositioningMode extends Enum<HitboxPositioningMode>
The type of relative positioning to use for an Immersive built with ImmersiveBuilder. The API guarantees the below modes won't be removed and won't change names in terms of backwards-compatibility. Anything else, including the ordering of the modes and the amount of them are NOT part of the API, and may change at anytime.
Explanations and an example of how ImmersiveMC uses each mode:
  • HORIZONTAL_BLOCK_FACING: Positioning is done based on the direction the block faces, where the block does not face up or down. Positioning starts from the center of this face. From the perspective of a player facing the front of this block, +X moves the hitbox to the player's right, +Y moves the hitbox up on the world's Y axis, and +Z moves the hitbox towards the player. For example, ImmersiveMC uses this for furnaces.
  • TOP_PLAYER_FACING: Positioning is done from the top-center of the block, with the direction being based on the player's direction relative to the block, excluding UP and DOWN. From the perspective of a player facing the block from a side, +X moves the hitbox to the player's right, +Y moves the hitbox in the same direction the player is facing, and +Z moves the hitbox up on the world's Y axis. For example, ImmersiveMC uses this for the crafting table.
  • TOP_LITERAL: Positioning is done from the top-center of the block. All translations are done in literal world movements (+X moves on the X-axis positively, etc.). ImmersiveMC uses this for the jukebox.
  • TOP_BLOCK_FACING: The same as TOP_PLAYER_FACING, but the direction is based on the block's facing direction, rather than the player relative to the block. The block must not face vertically. ImmersiveMC uses this for the anvil.
  • HORIZONTAL_PLAYER_FACING: The same as HORIZONTAL_BLOCK_FACING, but positioning is done based on the player's direction relative to the block, like in TOP_PLAYER_FACING. ImmersiveMC uses this for the brewing stand.
  • BLOCK_FACING_NEG_X: The same as HORIZONTAL_BLOCK_FACING, but if the block faces up or down, calculations are done assuming the block faces south. This makes +X correspond to moving the hitbox west. ImmersiveMC uses this for the barrel, mainly for positioning the handle.
  • PLAYER_FACING_NO_DOWN: TOP_PLAYER_FACING if the player is above the block, and HORIZONTAL_PLAYER_FACING otherwise. ImmersiveMC uses this for the hopper.
  • PLAYER_FACING_FILTER_BLOCK_FACING: Positioning is done from the center of the block face opposite of the direction the player is facing, with relative movements are done from the next-closest direction. For example, if the player were facing west towards the block on a similar y-level as the block, the positioning starts from center of the eastern face of the block. In this example +X corresponds to moving the hitbox to the player's right, +Y corresponds to moving the hitbox up on the world's y-axis, and +Z moves the hitbox towards the player. ImmersiveMC uses this for the shulker box.
  • Enum Constant Details

  • Method Details

    • values

      public static HitboxPositioningMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HitboxPositioningMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null