Contents
Class Spectating
java.lang.Object
com.hypixel.hytale.server.core.modules.entity.component.Spectating
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
Marks a player entity as spectating, and which entity it is watching through the follow
camera. Session-only and never persisted.
Spectator behavior (visibility, NPC detection, item pickup, camera) keys on this component.
Entering a gamemode type with Spectator: true composes the full spectator state.
Immutable: watching a target or returning to free-fly means putting a new instance, and the spectator systems compose the camera from the change.
-
Field Summary
Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a free-flying spectating state with no watched target.Spectating(Ref<EntityStore> targetRef) Creates a spectating state watching the given target through the follow camera. -
Method Summary
Modifier and TypeMethodDescriptionclone()static ComponentType<EntityStore, Spectating> static booleanisSpectating(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Whether the entity is currently spectating.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Constructor Details
-
Spectating
public Spectating()Creates a free-flying spectating state with no watched target. -
Spectating
Creates a spectating state watching the given target through the follow camera.- Parameters:
targetRef- The entity reference to watch, ornullfor free-fly.
-
-
Method Details
-
getComponentType
- Returns:
- the registered
ComponentTypeof this component.
-
isSpectating
public static boolean isSpectating(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Whether the entity is currently spectating.- Parameters:
ref- The entity reference.componentAccessor- TheComponentAccessorfor component access.- Returns:
trueif the entity has theSpectatingcomponent.
-
getTargetRef
- Returns:
- the entity reference of the watched target, or
nullwhen free-flying.
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-