Class DoorBlockUtils

java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.DoorBlockUtils

public final class DoorBlockUtils extends Object
A utility class for performing door-related block functionality.
  • Field Details

    • OPEN_DOOR_IN

      public static final String OPEN_DOOR_IN
      The interaction state id sent to open an inward facing door.
      See Also:
    • OPEN_DOOR_OUT

      public static final String OPEN_DOOR_OUT
      The interaction state id sent to open an outward facing door.
      See Also:
    • CLOSE_DOOR_IN

      public static final String CLOSE_DOOR_IN
      The interaction state id sent to close a door from an inward open position.
      See Also:
    • CLOSE_DOOR_OUT

      public static final String CLOSE_DOOR_OUT
      The interaction state id sent to close a door from an outward open position.
      See Also:
  • Method Details

    • isHorizontalDoor

      public static boolean isHorizontalDoor(@Nonnull BlockType blockType)
      Determines whether the given block type has a horizontal door interaction (e.g. gates) as opposed to a vertical door (e.g. regular doors).
      Parameters:
      blockType - The block type to check.
      Returns:
      true if the block type has a horizontal door interaction, false otherwise.
    • getInteractionState

      @Nonnull public static String getInteractionState(@Nonnull DoorBlockUtils.DoorState fromState, @Nonnull DoorBlockUtils.DoorState doorState)
      Resolves the interaction state id to send when transitioning a door from fromState to doorState.
      Parameters:
      fromState - The previous door state.
      doorState - The new door state.
      Returns:
      The interaction state id to send.
    • getOppositeDoorState

      @Nonnull public static DoorBlockUtils.DoorState getOppositeDoorState(@Nonnull DoorBlockUtils.DoorState doorState)
      Returns the opposite door state of the given state. CLOSED maps to itself.
      Parameters:
      doorState - The current door state.
      Returns:
      The opposite door state.
    • isInFrontOfDoor

      public static boolean isInFrontOfDoor(@Nonnull org.joml.Vector3i blockPosition, @Nullable Rotation doorRotationYaw, @Nonnull org.joml.Vector3d viewerPosition)
      Determines whether the given world position is in front of a door, given the door's yaw.
      Parameters:
      blockPosition - The block position of the door.
      doorRotationYaw - The yaw rotation of the door, or null to treat as zero.
      viewerPosition - The position to test against the door's facing.
      Returns:
      true if viewerPosition is in front of the door, false otherwise.
    • canOpenDoor

      public static boolean canOpenDoor(@Nonnull ChunkStore chunkStore, @Nonnull org.joml.Vector3i blockPosition, @Nonnull String state)
      Determines whether the door at blockPosition can be transitioned to the given interaction state without overlapping any other non-filler blocks.
      Parameters:
      chunkStore - The ChunkStore for chunk reference resolution.
      blockPosition - The block position of the door.
      state - The interaction state to test.
      Returns:
      true if the door can transition to the given state, false otherwise.