Interface ModeledEntity

All Superinterfaces:
IModel

public interface ModeledEntity extends IModel
The container class of multiple ActiveModels.
This class handles all attribute general to the model carrier, but not specific to any instances of ActiveModel.
  • 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 all ActiveModel.
    • getBase

      BaseEntity<?> getBase()
      The wrapped owner of this ModeledEntity instance.
      Returns:
      the owner
    • getRangeManager

      RangeManager getRangeManager()
      Get the RangeManager 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 of ActiveModel in this entity.
    • getLocation

      org.bukkit.util.Vector getLocation()
      Get the vector location of the wrapped owner.
    • getMoveController

      MoveController getMoveController()
      Get the MoveController of this entity.
      This is mainly used to control this entity with MountController.
    • getLookController

      LookController getLookController()
      Get the LookController of this entity.
      This is mainly used to control the entity's pitch, head yaw and body yaw.
    • getBodyRotationController

      BodyRotationController getBodyRotationController()
      Get the BodyRotationController of this entity.
      This is used to configure the entity's body rotation.
    • getMountManager

      MountManager getMountManager()
      Get the MountManager 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

      void addModel(ActiveModel model, boolean overrideHitbox)
      Add an ActiveModel into this entity.
      A freshly created ActiveModel 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 with removeModel(String) and check ActiveModel.isSwappable() to ensure the model can be transferred.
      Parameters:
      model - a fresh model or a swappable model
      overrideHitbox - should the current hitbox be replaced
    • removeModel

      ActiveModel removeModel(String modelId)
      Remove an ActiveModel of the specified model ID from this entity.
      The model would not despawn by itself after removing. See addModel(ActiveModel, boolean) for an explanation.
      To despawn the model, use ActiveModel.destroy()
      Parameters:
      modelId - model ID of the model being removed.
      Returns:
      the removed model, or null if no model is found.
    • getModel

      ActiveModel getModel(String modelId)
      Get the ActiveModel 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

      void setState(ModelState state)
      Set the ModelState of this entity
      Parameters:
      state - a default state.
    • getState

      ModelState getState()
      Get this entity's current ModelState
    • isInitialized

      boolean isInitialized()
    • queuePostInitTask

      void queuePostInitTask(Runnable runnable)
    • updateModelHitbox

      void updateModelHitbox(org.bukkit.util.Consumer<ModelHitbox> consumer)