Package com.ticxo.modelengine.api.model
Interface ModeledEntity
- All Superinterfaces:
IModel
The container class of multiple
This class handles all attribute general to the model carrier, but not specific to any instances of
ActiveModel
s.This class handles all attribute general to the model carrier, but not specific to any instances of
ActiveModel
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addModel
(ActiveModel model, boolean overrideHitbox) void
destroy()
Clear and despawn allActiveModel
.boolean
getAnimationState
(boolean flag) Check whether this entity is playing animations or not.BaseEntity<?>
getBase()
The wrapped owner of this ModeledEntity instance.Get theBodyRotationController
of this entity.
This is used to configure the entity's body rotation.float
Get the body yaw of this entity.float
Get the head pitch of this entity.float
Get the head yaw of this entity.org.bukkit.util.Vector
Get the vector location of the wrapped owner.Get theLookController
of this entity.
This is mainly used to control the entity's pitch, head yaw and body yaw.Get theActiveModel
of the specified model ID from this entity.Get the complete map ofActiveModel
in this entity.Get theMountManager
of this ModeledEntity.
This is used to mount an entity to this entity.Get theMoveController
of this entity.
This is mainly used to control this entity withMountController
.Get theRangeManager
of this entity.
This is mainly used to add & remove player from viewing, or change the render distance of this model.getState()
Get this entity's currentModelState
void
hurt()
Play the hurt animation.boolean
boolean
Get rotation lock state.void
queuePostInitTask
(Runnable runnable) removeModel
(String modelId) Remove anActiveModel
of the specified model ID from this entity.
The model would not despawn by itself after removing.void
setModelRotationLock
(boolean flag) Set the rotation setting of this entity.
When rotation is locked, all rotations caused by the entity would be canceled visually.void
setRenderRadius
(int radius) Set the render distance of this entity.void
setState
(ModelState state) Set theModelState
of this entityvoid
setStepHeight
(double height) Set the step height of this entity.
Due to Minecraft being stupid, some entities like pigs are not affected by this.boolean
tick()
Update method that is called every tick.
This method is called on an async thread.void
updateModelHitbox
(org.bukkit.util.Consumer<ModelHitbox> consumer) Methods inherited from interface com.ticxo.modelengine.api.model.IModel
hideFromPlayer, isBaseEntityVisible, setBaseEntityVisible, showToPlayer
-
Method Details
-
tick
boolean tick()Update method that is called every tick.
This method is called on an async thread. Beware when accessing the Bukkit API.- Returns:
- false to signify the model can be removed from the ticker.
-
destroy
void destroy()Clear and despawn allActiveModel
. -
getBase
BaseEntity<?> getBase()The wrapped owner of this ModeledEntity instance.- Returns:
- the owner
-
getRangeManager
RangeManager getRangeManager()Get theRangeManager
of this entity.
This is mainly used to add & remove player from viewing, or change the render distance of this model.- Returns:
- the
RangeManager
specific to this ModeledEntity.
-
getModels
Map<String,ActiveModel> getModels()Get the complete map ofActiveModel
in this entity. -
getLocation
org.bukkit.util.Vector getLocation()Get the vector location of the wrapped owner. -
getMoveController
MoveController getMoveController()Get theMoveController
of this entity.
This is mainly used to control this entity withMountController
. -
getLookController
LookController getLookController()Get theLookController
of this entity.
This is mainly used to control the entity's pitch, head yaw and body yaw. -
getBodyRotationController
BodyRotationController getBodyRotationController()Get theBodyRotationController
of this entity.
This is used to configure the entity's body rotation. -
getMountManager
MountManager getMountManager()Get theMountManager
of this ModeledEntity.
This is used to mount an entity to this entity. -
setStepHeight
void setStepHeight(double height) Set the step height of this entity.
Due to Minecraft being stupid, some entities like pigs are not affected by this.- Parameters:
height
- height in blocks
-
setRenderRadius
void setRenderRadius(int radius) Set the render distance of this entity.- Parameters:
radius
- distance in blocks
-
hurt
void hurt()Play the hurt animation. The animation would stop after 0.5 second. -
addModel
Add anActiveModel
into this entity.
A freshly createdActiveModel
can be added without worries. However, if you are moving a model from a different entity, please first remove the model from the other entity withremoveModel(String)
and checkActiveModel.isSwappable()
to ensure the model can be transferred.- Parameters:
model
- a fresh model or a swappable modeloverrideHitbox
- should the current hitbox be replaced
-
removeModel
Remove anActiveModel
of the specified model ID from this entity.
The model would not despawn by itself after removing. SeeaddModel(ActiveModel, boolean)
for an explanation.
To despawn the model, useActiveModel.destroy()
- Parameters:
modelId
- model ID of the model being removed.- Returns:
- the removed model, or null if no model is found.
-
getModel
Get theActiveModel
of the specified model ID from this entity.- Parameters:
modelId
- model ID of the model- Returns:
- the model, or null if no model is found.
-
setModelRotationLock
void setModelRotationLock(boolean flag) Set the rotation setting of this entity.
When rotation is locked, all rotations caused by the entity would be canceled visually. This includes head and body rotation, but does not affect animations.- Parameters:
flag
- true to lock
-
isModelRotationLock
boolean isModelRotationLock()Get rotation lock state. -
getHeadYaw
float getHeadYaw()Get the head yaw of this entity. -
getHeadPitch
float getHeadPitch()Get the head pitch of this entity. -
getBodyYaw
float getBodyYaw()Get the body yaw of this entity. -
getAnimationState
boolean getAnimationState(boolean flag) Check whether this entity is playing animations or not.- Parameters:
flag
- check mode- Returns:
- if flag is true, returns true when at least one model is playing animation.
if flag is false, returns true when no models are playing animations.
-
setState
Set theModelState
of this entity- Parameters:
state
- a default state.
-
getState
ModelState getState()Get this entity's currentModelState
-
isInitialized
boolean isInitialized() -
queuePostInitTask
-
updateModelHitbox
-