Package com.ticxo.modelengine.api.entity
Interface BaseEntity<T>
- All Known Implementing Classes:
BukkitEntity
,BukkitPlayer
,Dummy
public interface BaseEntity<T>
Interface used by
For bukkit entities, use
For bukkit players, use
For general purpose player-specific targets, use
ModeledEntity
to retrieve information about the entity.For bukkit entities, use
BukkitEntity
.For bukkit players, use
BukkitPlayer
.For general purpose player-specific targets, use
Dummy
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the target becomes invisible.
For bukkit entities and players, useEntityHandler.broadcastDespawnPacket(BaseEntity, boolean)
void
Called when the target becomes visible again.
For bukkit entities and players, useEntityHandler.broadcastSpawnPacket(BaseEntity, boolean)
int
Get the entity ID of this entity.
If the target is not a bukkit entity, you have to be absolutely sure that this ID does not overlap with an existing entity, as it is used to identify interactions between models.
UseEntityHandler.getEntityCounter()
to generate unique integer ID if you are unsure.Get the hitbox of this entity.org.bukkit.inventory.ItemStack
getItemInSlot
(org.bukkit.inventory.EquipmentSlot slot) org.bukkit.Location
Get the location of this entity.Get the wrapped target.List<org.bukkit.entity.Entity>
Return the wrapped render range manager created inwrapRangeManager(IModel)
.Get the step height of this entity.Get the UUID of this entity.
This UUID is used to retrieve the instance ofModeledEntity
associated with this entity.org.bukkit.World
getWorld()
Get the world of this entity.float
float
float
boolean
isDead()
boolean
boolean
isMoving()
boolean
boolean
onHurt
(IDamageSource damageSource, float damage) Called when a sub-hitbox of this entity detects an attack.
For default bukkit behavior, useEntityHandler.hurt(Entity, IDamageSource, float)
.void
onInteract
(org.bukkit.entity.Player player, org.bukkit.inventory.EquipmentSlot hand) Called when a sub-hitbox of this entity detects an interaction.
For default bukkit behavior, useEntityHandler.interact(Entity, Player, EquipmentSlot)
.void
setCollidableToLiving
(org.bukkit.entity.LivingEntity living, boolean isRemove) Configure whether the targeted living entity can collide with this entityvoid
Set the hitbox of this entity.
For bukkit entities, useEntityHandler.setHitbox(Entity, Hitbox)
.void
setStepHeight
(double height) Set the step height of this entity.
For bukkit entities, useEntityHandler.setStepHeight(Entity, double)
void
setYBodyRot
(float rot) void
setYHeadRot
(float rot) Create a wrapper for the body rotation control of this entity.
For bukkit entities, wrap withEntityHandler.wrapBodyRotationControl(Entity)
.Create a wrapper for the look control of this entity.
For bukkit entities, wrap withEntityHandler.wrapLookControl(Entity)
.Create a wrapper for the movement control of this entity.
For bukkit entities, wrap withEntityHandler.wrapMoveControl(Entity)
.void
Patch Minecraft's faulty pathfinding to accept different hitbox sizes.
For bukkit entities, wrap withEntityHandler.wrapNavigation(Entity)
.wrapRangeManager
(IModel model) Create a wrapper for the render range manager of this entity.
For bukkit entities, wrap withEntityHandler.wrapRangeManager(Entity)
.
-
Method Details
-
getOriginal
T getOriginal()Get the wrapped target. -
wrapMoveControl
MoveController wrapMoveControl()Create a wrapper for the movement control of this entity.
For bukkit entities, wrap withEntityHandler.wrapMoveControl(Entity)
. -
wrapLookControl
LookController wrapLookControl()Create a wrapper for the look control of this entity.
For bukkit entities, wrap withEntityHandler.wrapLookControl(Entity)
. -
wrapBodyRotationControl
BodyRotationController wrapBodyRotationControl()Create a wrapper for the body rotation control of this entity.
For bukkit entities, wrap withEntityHandler.wrapBodyRotationControl(Entity)
. -
wrapRangeManager
Create a wrapper for the render range manager of this entity.
For bukkit entities, wrap withEntityHandler.wrapRangeManager(Entity)
. -
getRangeManager
RangeManager getRangeManager()Return the wrapped render range manager created inwrapRangeManager(IModel)
. -
onHurt
Called when a sub-hitbox of this entity detects an attack.
For default bukkit behavior, useEntityHandler.hurt(Entity, IDamageSource, float)
.- Parameters:
damageSource
- the damage source of this attackdamage
- raw damage before reduction- Returns:
- false to cancel the attack.
-
onInteract
void onInteract(org.bukkit.entity.Player player, org.bukkit.inventory.EquipmentSlot hand) Called when a sub-hitbox of this entity detects an interaction.
For default bukkit behavior, useEntityHandler.interact(Entity, Player, EquipmentSlot)
.- Parameters:
player
- the triggerhand
- hand used to interact
-
setHitbox
Set the hitbox of this entity.
For bukkit entities, useEntityHandler.setHitbox(Entity, Hitbox)
. -
getHitbox
Hitbox getHitbox()Get the hitbox of this entity. -
getModelHitbox
ModelHitbox getModelHitbox() -
setStepHeight
void setStepHeight(double height) Set the step height of this entity.
For bukkit entities, useEntityHandler.setStepHeight(Entity, double)
- Parameters:
height
- height in blocks
-
getStepHeight
Double getStepHeight()Get the step height of this entity.- Returns:
- the step height, or null if it could not be determined.
-
setCollidableToLiving
void setCollidableToLiving(org.bukkit.entity.LivingEntity living, boolean isRemove) Configure whether the targeted living entity can collide with this entity- Parameters:
living
- The targeted living entityisRemove
- Can be collided
-
broadcastSpawnPacket
void broadcastSpawnPacket()Called when the target becomes visible again.
For bukkit entities and players, useEntityHandler.broadcastSpawnPacket(BaseEntity, boolean)
-
broadcastDespawnPacket
void broadcastDespawnPacket()Called when the target becomes invisible.
For bukkit entities and players, useEntityHandler.broadcastDespawnPacket(BaseEntity, boolean)
-
getEntityId
int getEntityId()Get the entity ID of this entity.
If the target is not a bukkit entity, you have to be absolutely sure that this ID does not overlap with an existing entity, as it is used to identify interactions between models.
UseEntityHandler.getEntityCounter()
to generate unique integer ID if you are unsure. -
getUniqueId
UUID getUniqueId()Get the UUID of this entity.
This UUID is used to retrieve the instance ofModeledEntity
associated with this entity. SeeModelEngineAPI.getModeledEntity(UUID)
. -
getLocation
org.bukkit.Location getLocation()Get the location of this entity. -
getWorld
org.bukkit.World getWorld()Get the world of this entity. -
isDead
boolean isDead() -
isGlowing
boolean isGlowing() -
isOnGround
boolean isOnGround() -
isMoving
boolean isMoving() -
setYHeadRot
void setYHeadRot(float rot) -
getYHeadRot
float getYHeadRot() -
getXHeadRot
float getXHeadRot() -
setYBodyRot
void setYBodyRot(float rot) -
getYBodyRot
float getYBodyRot() -
getPassengers
List<org.bukkit.entity.Entity> getPassengers() -
getItemInSlot
org.bukkit.inventory.ItemStack getItemInSlot(org.bukkit.inventory.EquipmentSlot slot)
-