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
ActiveModels.This class handles all attribute general to the model carrier, but not specific to any instances of
ActiveModel.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddModel(ActiveModel model, boolean overrideHitbox) voiddestroy()Clear and despawn allActiveModel.booleangetAnimationState(boolean flag) Check whether this entity is playing animations or not.BaseEntity<?>getBase()The wrapped owner of this ModeledEntity instance.Get theBodyRotationControllerof this entity.
This is used to configure the entity's body rotation.floatGet the body yaw of this entity.floatGet the head pitch of this entity.floatGet the head yaw of this entity.org.bukkit.util.VectorGet the vector location of the wrapped owner.Get theLookControllerof this entity.
This is mainly used to control the entity's pitch, head yaw and body yaw.Get theActiveModelof the specified model ID from this entity.Get the complete map ofActiveModelin this entity.Get theMountManagerof this ModeledEntity.
This is used to mount an entity to this entity.Get theMoveControllerof this entity.
This is mainly used to control this entity withMountController.Get theRangeManagerof 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 currentModelStatevoidhurt()Play the hurt animation.booleanbooleanGet rotation lock state.voidqueuePostInitTask(Runnable runnable) removeModel(String modelId) Remove anActiveModelof the specified model ID from this entity.
The model would not despawn by itself after removing.voidsetModelRotationLock(boolean flag) Set the rotation setting of this entity.
When rotation is locked, all rotations caused by the entity would be canceled visually.voidsetRenderRadius(int radius) Set the render distance of this entity.voidsetState(ModelState state) Set theModelStateof this entityvoidsetStepHeight(double height) Set the step height of this entity.
Due to Minecraft being stupid, some entities like pigs are not affected by this.booleantick()Update method that is called every tick.
This method is called on an async thread.voidupdateModelHitbox(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 theRangeManagerof this entity.
This is mainly used to add & remove player from viewing, or change the render distance of this model.- Returns:
- the
RangeManagerspecific to this ModeledEntity.
-
getModels
Map<String,ActiveModel> getModels()Get the complete map ofActiveModelin this entity. -
getLocation
org.bukkit.util.Vector getLocation()Get the vector location of the wrapped owner. -
getMoveController
MoveController getMoveController()Get theMoveControllerof this entity.
This is mainly used to control this entity withMountController. -
getLookController
LookController getLookController()Get theLookControllerof this entity.
This is mainly used to control the entity's pitch, head yaw and body yaw. -
getBodyRotationController
BodyRotationController getBodyRotationController()Get theBodyRotationControllerof this entity.
This is used to configure the entity's body rotation. -
getMountManager
MountManager getMountManager()Get theMountManagerof 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 anActiveModelinto this entity.
A freshly createdActiveModelcan 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 anActiveModelof 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 theActiveModelof 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 theModelStateof this entity- Parameters:
state- a default state.
-
getState
ModelState getState()Get this entity's currentModelState -
isInitialized
boolean isInitialized() -
queuePostInitTask
-
updateModelHitbox
-