Contents
Class DoorBlockUtils
java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.DoorBlockUtils
A utility class for performing door-related block functionality.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the open/closed state of a door. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe interaction state id sent to close a door from an inward open position.static final StringThe interaction state id sent to close a door from an outward open position.static final StringThe interaction state id sent to open an inward facing door.static final StringThe interaction state id sent to open an outward facing door. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanOpenDoor(ChunkStore chunkStore, org.joml.Vector3i blockPosition, String state) Determines whether the door atblockPositioncan be transitioned to the given interaction state without overlapping any other non-filler blocks.static StringgetInteractionState(DoorBlockUtils.DoorState fromState, DoorBlockUtils.DoorState doorState) Resolves the interaction state id to send when transitioning a door fromfromStatetodoorState.static DoorBlockUtils.DoorStategetOppositeDoorState(DoorBlockUtils.DoorState doorState) Returns the opposite door state of the given state.static booleanisHorizontalDoor(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).static booleanisInFrontOfDoor(org.joml.Vector3i blockPosition, Rotation doorRotationYaw, org.joml.Vector3d viewerPosition) Determines whether the given world position is in front of a door, given the door's yaw.
-
Field Details
-
OPEN_DOOR_IN
The interaction state id sent to open an inward facing door.- See Also:
-
OPEN_DOOR_OUT
The interaction state id sent to open an outward facing door.- See Also:
-
CLOSE_DOOR_IN
The interaction state id sent to close a door from an inward open position.- See Also:
-
CLOSE_DOOR_OUT
The interaction state id sent to close a door from an outward open position.- See Also:
-
-
Method Details
-
isHorizontalDoor
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:
trueif the block type has a horizontal door interaction,falseotherwise.
-
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 fromfromStatetodoorState.- 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, ornullto treat as zero.viewerPosition- The position to test against the door's facing.- Returns:
trueifviewerPositionis in front of the door,falseotherwise.
-
canOpenDoor
public static boolean canOpenDoor(@Nonnull ChunkStore chunkStore, @Nonnull org.joml.Vector3i blockPosition, @Nonnull String state) Determines whether the door atblockPositioncan be transitioned to the given interaction state without overlapping any other non-filler blocks.- Parameters:
chunkStore- TheChunkStorefor chunk reference resolution.blockPosition- The block position of the door.state- The interaction state to test.- Returns:
trueif the door can transition to the given state,falseotherwise.
-