public interface Attachment
Modifier and Type | Method and Description |
---|---|
default void |
addAnimation(Animation animation)
Adds a new animation to this attachment, which can then be played
again when specifying the name of the animation in the animation options.
|
default void |
addChild(Attachment child)
Adds a controller as a child of this one, which will have positions
relative to this one.
|
default void |
applyDefaultSeatTransform(com.bergerkiller.bukkit.common.math.Matrix4x4 transform)
Some attachment types, like entities, will have a default position relative
to it where the player is normally seated.
|
default void |
clearAnimations()
Clears all animations stored for this attachment
|
default boolean |
containsEntityId(int entityId)
Gets whether this attachment uses a particular Entity Id as part of
displaying its contents in the world.
|
default Attachment |
findChild(int[] targetPath)
Traverses down this tree of attachments based on the target
path indices specified.
|
default Collection<Animation> |
getAnimations()
Gets a read-only collection of animations stored using
addAnimation(Animation) . |
default List<Attachment> |
getChildren()
Gets a list of children of this controller.
|
default com.bergerkiller.bukkit.common.config.ConfigurationNode |
getConfig()
Gets the configuration of this attachment.
|
default ObjectPosition |
getConfiguredPosition()
Gets the configured parent-relative object position of this attachment.
|
default Animation |
getCurrentAnimation()
Gets the animation that is currently playing.
|
AttachmentInternalState |
getInternalState()
Gets controller internal state information.
|
default AttachmentManager |
getManager()
Gets the attachment manager instance that initialized this attachment
and oversees its interaction with the outside environment.
|
default Attachment |
getParent()
Gets the parent controller of this controller, if one is available.
|
default com.bergerkiller.bukkit.common.math.Matrix4x4 |
getPreviousTransform()
Gets the transformation matrix that was applied to the entity
in the previous tick (update).
|
default com.bergerkiller.bukkit.common.math.Matrix4x4 |
getTransform()
Gets the transformation matrix that is currently applied to obtain the
absolute world-coordinates position and rotation of this attachment.
|
Collection<org.bukkit.entity.Player> |
getViewers()
Gets all the viewers of this attachment
|
default boolean |
isActive()
Gets whether or not this attachment is active.
|
default boolean |
isAttached()
Gets whether this attachment has been attached.
|
default boolean |
isFocused()
Gets whether this attachment is focused.
|
default boolean |
isHiddenWhenInactive()
Gets whether this attachment is hidden (
makeHidden(Player) ) when the
attachment or a parent attachment is inactive. |
void |
makeHidden(org.bukkit.entity.Player viewer)
Makes this attachment invisible (despawns) for a viewer.
|
void |
makeVisible(org.bukkit.entity.Player viewer)
Makes this attachment visible to a viewer for the first time.
|
void |
onAttached()
Called when the controller is attached to the real world.
|
default void |
onBlur()
Called when an attachment loses focus in the editor or by other means.
|
void |
onDetached()
Called when the controller is detached from the real world.
|
default void |
onFocus()
Called when an attachment is focused in the editor or by other means.
|
void |
onLoad(com.bergerkiller.bukkit.common.config.ConfigurationNode config)
Called when the attachment need to (re)load the configuration.
|
void |
onMove(boolean absolute)
Called every now and then to refresh the position of the attachment
|
void |
onTick()
Called every tick to update the attachment
|
void |
onTransformChanged(com.bergerkiller.bukkit.common.math.Matrix4x4 transform)
Called right after the
getTransform() has been updated. |
default boolean |
playNamedAnimation(AnimationOptions options)
Starts an animation for this attachment.
|
default boolean |
playNamedAnimation(String name)
Starts an animation for this attachment.
|
default boolean |
playNamedAnimationRecursive(AnimationOptions options)
Starts an animation for this attachment and all child attachments
recursively.
|
default boolean |
playNamedAnimationRecursive(String name)
Starts a named animation for this attachment and all child attachments
recursively.
|
default void |
setActive(boolean active)
Sets whether this attachment is active.
|
default void |
setFocused(boolean focused)
Sets whether this attachment is focused.
|
default void |
startAnimation(Animation animation)
Starts playing an animation for this attachment.
|
default void |
stopAnimation()
Stops the playback of any animations playing or queued right now.
|
AttachmentInternalState getInternalState()
default AttachmentManager getManager()
default com.bergerkiller.bukkit.common.config.ConfigurationNode getConfig()
onAttached()
is called.
The configuration is mutable, and when properties of the attachment are
changed, they should be updated in the configuration before or
during onDetached()
.void onAttached()
void onDetached()
#onSave(config)
is called
before this method is called, if saving is required.void onLoad(com.bergerkiller.bukkit.common.config.ConfigurationNode config)
onAttached()
is called for the first time,
and when configuration is reloaded while the attachment remains attached.
A guarantee is made that the attachment will be attached when this method is called.config
- The configuration of the attachmentvoid onTick()
void onTransformChanged(com.bergerkiller.bukkit.common.math.Matrix4x4 transform)
getTransform()
has been updated.
Additional transformations can be performed here on the transformation matrix,
and position information can be calculated.transform
- (same as getTransform()
but mutable)void onMove(boolean absolute)
absolute
- whether this is an absolute (synchronize) movement update.
If this is true, the position information should be refreshed.default boolean isAttached()
onAttached()
was last called. It returns false if this was never
called, or onDetached()
was last called.default boolean isFocused()
onFocus()
was last called. It returns false if this was never called, or onBlur()
was last called.default void setFocused(boolean focused)
isFocused()
state, as well call the onFocus()
or onBlur()
callbacks as required.focused
- state to set todefault void onFocus()
default void onBlur()
onFocus()
.void makeVisible(org.bukkit.entity.Player viewer)
onAttached()
is called,
and whenever a new viewer moves within range.viewer
- to make it visible tovoid makeHidden(org.bukkit.entity.Player viewer)
onDetached()
is called,
and whenever a new viewer moves out of range.viewer
- to hide it fromdefault ObjectPosition getConfiguredPosition()
default com.bergerkiller.bukkit.common.math.Matrix4x4 getPreviousTransform()
getTransform()
.default com.bergerkiller.bukkit.common.math.Matrix4x4 getTransform()
default void addChild(Attachment child)
child
- controller to adddefault List<Attachment> getChildren()
default Attachment getParent()
Collection<org.bukkit.entity.Player> getViewers()
default boolean isHiddenWhenInactive()
makeHidden(Player)
) when the
attachment or a parent attachment is inactive.default boolean isActive()
setActive(boolean)
.default void setActive(boolean active)
active
- statedefault void applyDefaultSeatTransform(com.bergerkiller.bukkit.common.math.Matrix4x4 transform)
transform
- to apply the transformation to. The input transform will be the current
position of this attachment.default void addAnimation(Animation animation)
animation
- to adddefault Collection<Animation> getAnimations()
addAnimation(Animation)
.default void clearAnimations()
default Animation getCurrentAnimation()
default void stopAnimation()
default void startAnimation(Animation animation)
stopAnimation()
prior.animation
- to startdefault boolean containsEntityId(int entityId)
entityId
- default boolean playNamedAnimationRecursive(String name)
name
- of the animationdefault boolean playNamedAnimationRecursive(AnimationOptions options)
options
- that specify the animation and animation configurationdefault boolean playNamedAnimation(String name)
name
- of the animationdefault boolean playNamedAnimation(AnimationOptions options)
options
- that specify the animation and animation configurationdefault Attachment findChild(int[] targetPath)
targetPath
- Copyright © 2019. All rights reserved.