Skip to content

BlockMountComponent

Package: com.hypixel.hytale.builtin.mounts

public class BlockMountComponent implements Component<ChunkStore>

A ChunkStore ECS component that tracks entities seated on a block-based mount point (seat or bed). Maintains bidirectional maps between BlockMountPoint instances and seated entity references. Created by BlockMountAPI.mountOnBlock() when an entity first sits on a block.

public static ComponentType<ChunkStore, BlockMountComponent> getComponentType()

Delegates to MountPlugin.getInstance().getBlockMountComponentType().

public BlockMountComponent()

Default constructor.

public BlockMountComponent(BlockMountType type, Vector3i blockPos, BlockType expectedBlockType, int expectedRotation)

Constructs a component with the mount type, block position, expected block type, and rotation index.

MethodReturnsDescription
getType()BlockMountTypeThe mount type (Seat or Bed).
getBlockPos()Vector3iThe world-space block position.
getExpectedBlockType()BlockTypeThe block type at mount creation time.
getExpectedRotation()intThe block rotation index at mount creation time.
public boolean isDead()

Returns true if no entities are seated after cleaning invalid references. Used by MountSystems.TrackedMounted to determine whether the component should be removed.

public void putSeatedEntity(@Nonnull BlockMountPoint mountPoint, @Nonnull Ref<EntityStore> seatedEntity)

Records that the given entity is seated at the specified mount point.

public void removeSeatedEntity(@Nonnull Ref<EntityStore> seatedEntity)

Removes the entity from the seat tracking maps.

@Nullable
public BlockMountPoint getSeatBlockBySeatedEntity(Ref<EntityStore> seatedEntity)

Returns the BlockMountPoint occupied by the given entity, or null.

@Nonnull
public Collection<? extends Ref<EntityStore>> getSeatedEntities()

Returns all currently seated entity references.

@Nullable
public BlockMountPoint findAvailableSeat(@Nonnull Vector3i targetBlock, @Nonnull BlockMountPoint[] choices, @Nonnull Vector3f whereWasClicked)

Finds the closest unoccupied mount point to the click position. Cleans invalid references first, then iterates all choices computing squared distance to whereWasClicked in world space. Returns the closest available seat, or null if all are occupied.

@Nonnull
@Override
public Component<ChunkStore> clone()

Returns a shallow copy with cloned seat maps.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.