Contents
Class BeamComponent
java.lang.Object
com.hypixel.hytale.builtin.beam.BeamComponent
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
Gives an entity beams that its viewers render. The beams are runtime state, so they are never
saved with the entity.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe most beams one entity can have.static final floatPassed tospawn(Store, Vector3d, AttachedBeam...)for an entity that lives until something removes it.Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AttachedBeam beam) voidclear()clone()booleanReturns whether the beams changed since the last call, and clears the change.getBeams()Returns a read-only view of the beams of this entity.static ComponentType<EntityStore, BeamComponent> booleanisEmpty()booleanremove(AttachedBeam beam) voidDrops the beams whose target entity is gone.voidset(List<AttachedBeam> newBeams) static Ref<EntityStore> spawn(Store<EntityStore> store, org.joml.Vector3d position, float lifetime, AttachedBeam... beams) Spawns an entity that has beams but no model, for beams that do not belong to anything else.static Ref<EntityStore> spawn(Store<EntityStore> store, org.joml.Vector3d position, AttachedBeam... beams) Spawns an entity that has beams but no model, and keeps it until something removes it.toString()Methods inherited from interface Component
cloneSerializable
-
Field Details
-
MAX_BEAMS
public static final int MAX_BEAMSThe most beams one entity can have. The wire format rejects more than this, so the extra ones are dropped instead of failing the send.- See Also:
-
NO_LIFETIME
public static final float NO_LIFETIMEPassed tospawn(Store, Vector3d, AttachedBeam...)for an entity that lives until something removes it.- See Also:
-
-
Constructor Details
-
BeamComponent
public BeamComponent() -
BeamComponent
-
BeamComponent
-
-
Method Details
-
getComponentType
-
spawn
@Nonnull public static Ref<EntityStore> spawn(@Nonnull Store<EntityStore> store, @Nonnull org.joml.Vector3d position, @Nonnull AttachedBeam... beams) Spawns an entity that has beams but no model, and keeps it until something removes it.- Parameters:
position- the position the entity is tracked at, which decides who can see the beams
-
spawn
@Nonnull public static Ref<EntityStore> spawn(@Nonnull Store<EntityStore> store, @Nonnull org.joml.Vector3d position, float lifetime, @Nonnull AttachedBeam... beams) Spawns an entity that has beams but no model, for beams that do not belong to anything else. The entity is replicated so viewers can render its beams, and it is never saved.- Parameters:
position- the position the entity is tracked at, which decides who can see the beamslifetime- how long the entity lives for, in seconds, orNO_LIFETIMEto keep it until something removes it
-
getBeams
Returns a read-only view of the beams of this entity. Change them through this component so viewers are told about the change. -
add
-
remove
-
set
-
clear
public void clear() -
isEmpty
public boolean isEmpty() -
removeInvalid
public void removeInvalid()Drops the beams whose target entity is gone. -
consumeNetworkOutdated
public boolean consumeNetworkOutdated()Returns whether the beams changed since the last call, and clears the change. -
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-
toString
-