Package com.ticxo.modelengine.api.entity
Class BukkitEntity
java.lang.Object
com.ticxo.modelengine.api.entity.BukkitEntity
- All Implemented Interfaces:
BaseEntity<org.bukkit.entity.Entity>
Default implementation of
For simple usage, this is all you would need.
BaseEntity
to wrap the default bukkit's Entity
class.For simple usage, this is all you would need.
-
Constructor Summary
-
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.org.bukkit.inventory.ItemStack
getItemInSlot
(org.bukkit.inventory.EquipmentSlot slot) org.bukkit.Location
Get the location of this entity.List<org.bukkit.entity.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)
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ticxo.modelengine.api.entity.BaseEntity
getHitbox, getModelHitbox, getOriginal, getRangeManager, getStepHeight
-
Constructor Details
-
BukkitEntity
public BukkitEntity(@NotNull @NotNull org.bukkit.entity.Entity entity)
-
-
Method Details
-
wrapMoveControl
Description copied from interface:BaseEntity
Create a wrapper for the movement control of this entity.
For bukkit entities, wrap withEntityHandler.wrapMoveControl(Entity)
.- Specified by:
wrapMoveControl
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
wrapLookControl
Description copied from interface:BaseEntity
Create a wrapper for the look control of this entity.
For bukkit entities, wrap withEntityHandler.wrapLookControl(Entity)
.- Specified by:
wrapLookControl
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
wrapBodyRotationControl
Description copied from interface:BaseEntity
Create a wrapper for the body rotation control of this entity.
For bukkit entities, wrap withEntityHandler.wrapBodyRotationControl(Entity)
.- Specified by:
wrapBodyRotationControl
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
wrapRangeManager
Description copied from interface:BaseEntity
Create a wrapper for the render range manager of this entity.
For bukkit entities, wrap withEntityHandler.wrapRangeManager(Entity)
.- Specified by:
wrapRangeManager
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
onHurt
Description copied from interface:BaseEntity
Called when a sub-hitbox of this entity detects an attack.
For default bukkit behavior, useEntityHandler.hurt(Entity, IDamageSource, float)
.- Specified by:
onHurt
in interfaceBaseEntity<org.bukkit.entity.Entity>
- Parameters:
damageSource
- the damage source of this attackdamage
- raw damage before reduction- Returns:
- false to cancel the attack.
-
onInteract
public void onInteract(org.bukkit.entity.Player player, org.bukkit.inventory.EquipmentSlot hand) Description copied from interface:BaseEntity
Called when a sub-hitbox of this entity detects an interaction.
For default bukkit behavior, useEntityHandler.interact(Entity, Player, EquipmentSlot)
.- Specified by:
onInteract
in interfaceBaseEntity<org.bukkit.entity.Entity>
- Parameters:
player
- the triggerhand
- hand used to interact
-
setHitbox
Description copied from interface:BaseEntity
Set the hitbox of this entity.
For bukkit entities, useEntityHandler.setHitbox(Entity, Hitbox)
.- Specified by:
setHitbox
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
setStepHeight
public void setStepHeight(double height) Description copied from interface:BaseEntity
Set the step height of this entity.
For bukkit entities, useEntityHandler.setStepHeight(Entity, double)
- Specified by:
setStepHeight
in interfaceBaseEntity<org.bukkit.entity.Entity>
- Parameters:
height
- height in blocks
-
setCollidableToLiving
public void setCollidableToLiving(org.bukkit.entity.LivingEntity living, boolean isRemove) Description copied from interface:BaseEntity
Configure whether the targeted living entity can collide with this entity- Specified by:
setCollidableToLiving
in interfaceBaseEntity<org.bukkit.entity.Entity>
- Parameters:
living
- The targeted living entityisRemove
- Can be collided
-
broadcastSpawnPacket
public void broadcastSpawnPacket()Description copied from interface:BaseEntity
Called when the target becomes visible again.
For bukkit entities and players, useEntityHandler.broadcastSpawnPacket(BaseEntity, boolean)
- Specified by:
broadcastSpawnPacket
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
broadcastDespawnPacket
public void broadcastDespawnPacket()Description copied from interface:BaseEntity
Called when the target becomes invisible.
For bukkit entities and players, useEntityHandler.broadcastDespawnPacket(BaseEntity, boolean)
- Specified by:
broadcastDespawnPacket
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getEntityId
public int getEntityId()Description copied from interface:BaseEntity
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.- Specified by:
getEntityId
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getUniqueId
Description copied from interface:BaseEntity
Get the UUID of this entity.
This UUID is used to retrieve the instance ofModeledEntity
associated with this entity. SeeModelEngineAPI.getModeledEntity(UUID)
.- Specified by:
getUniqueId
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getLocation
public org.bukkit.Location getLocation()Description copied from interface:BaseEntity
Get the location of this entity.- Specified by:
getLocation
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getWorld
public org.bukkit.World getWorld()Description copied from interface:BaseEntity
Get the world of this entity.- Specified by:
getWorld
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
isDead
public boolean isDead()- Specified by:
isDead
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
isGlowing
public boolean isGlowing()- Specified by:
isGlowing
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
isOnGround
public boolean isOnGround()- Specified by:
isOnGround
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
isMoving
public boolean isMoving()- Specified by:
isMoving
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
setYHeadRot
public void setYHeadRot(float rot) - Specified by:
setYHeadRot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getYHeadRot
public float getYHeadRot()- Specified by:
getYHeadRot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getXHeadRot
public float getXHeadRot()- Specified by:
getXHeadRot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
setYBodyRot
public void setYBodyRot(float rot) - Specified by:
setYBodyRot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getYBodyRot
public float getYBodyRot()- Specified by:
getYBodyRot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getPassengers
- Specified by:
getPassengers
in interfaceBaseEntity<org.bukkit.entity.Entity>
-
getItemInSlot
public org.bukkit.inventory.ItemStack getItemInSlot(org.bukkit.inventory.EquipmentSlot slot) - Specified by:
getItemInSlot
in interfaceBaseEntity<org.bukkit.entity.Entity>
-