Package org.core.entity
Interface Entity<T extends Entity<?>>
- Type Parameters:
T
- Options are either LiveEntity or EntitySnapshot
- All Superinterfaces:
Positionable<SyncExactPosition>
- All Known Subinterfaces:
AbstractHuman<E>
,AgeableEntity<E>
,AnimalEntity<E>
,ArmoredEntity<E>
,AttachableEntity<E>
,BasicVillagerEntity<E>
,Bat<E>
,BatSnapshot
,Chicken<E>
,ChickenSnapshot
,ClassicZombie<E>
,ClassicZombieSnapshot
,Cod<E>
,CodSnapshot
,Cow<E>
,CowSnapshot
,Creature<E>
,CreeperEntity<E>
,CreeperEntitySnapshot
,DroppedItem<E>
,DroppedItemSnapshot
,EntitySnapshot<E>
,EntitySnapshot.NoneDestructibleSnapshot<E>
,FishEntity<E>
,HostileEntity<E>
,Human<E>
,HumanSnapshot
,InventoryHoldingEntity<E>
,ItemFrame<E>
,ItemFrameSnapshot
,ItemHoldingEntity<E>
,ItemProjectileEntity<E>
,LiveBat
,LiveChicken
,LiveClassicZombie
,LiveCod
,LiveCow
,LiveCreeperEntity
,LiveDroppedItem
,LiveEntity
,LiveHuman
,LiveItemFrame
,LiveMinecart
,LiveParrot
,LivePlayer
,LiveRideableMinecart
,LiveSnowballEntity
,LivingEntity<E>
,Merchant<E>
,Minecart<E>
,MinecartSnapshot
,Parrot<T>
,ParrotSnapshot
,Player<E>
,PlayerSnapshot
,ProjectileEntity<E>
,RideableMinecart<E>
,SnowballEntity<E>
,SnowballEntitySnapshot
,Tamer<E>
,TargetableEntity<E>
,WaterEntity<T>
,Zombie<E>
,ZombieVillager<E>
Class to represent all Entity types within the Minecraft game
-
Method Summary
Modifier and TypeMethodDescriptionaddPassengers(Collection<? extends T> entities)
Adds passengers to the current entity.addPassengers(T... entities)
Adds passengers to the current entity.Removes all passengers from the entityEntitySnapshot<? extends LiveEntity>
Create a snapshot of this instance of the entitydefault Optional<SyncBlockPosition>
Gets the block that the entity is attached to, this could be the block that the entity is standing onOptional<net.kyori.adventure.text.Component>
default Direction
Gets the position the entity is facing in as a DirectionGets the passengers of the entity.double
getPitch()
Gets the current pitch of the entityGets the position the entity is.double
getRoll()
Gets the roll of the entity, note that as Bukkit does not support roll, then the result will be 0<E extends LiveEntity>
EntityType<E,? extends EntitySnapshot<E>>getType()
Gets the type of the entityGets the current velocity of the entitydouble
getYaw()
Gets the yaw of the current entityboolean
Checks if the entity has gravitydefault boolean
Checks if this entity has any passengersboolean
Checks if the custom name should be visibleboolean
Checks if the entity is on groundboolean
removePassengers(Collection<T> entities)
Removes passengers to the current entity.removePassengers(T... entities)
Removes passengers to the current entity.setCustomName(@Nullable net.kyori.adventure.text.Component component)
setCustomName(@Nullable net.kyori.adventure.text.ComponentLike like)
setCustomNameVisible(boolean visible)
Sets if the custom name should be visiblesetGravity(boolean check)
Sets if the entity has gravity or notsetPitch(double value)
Sets the pitch of the entities rotationdefault boolean
setPosition(double x, double y, double z)
Sets the position of the entity without the need of a Position, this maintains the world that the entity is indefault boolean
setPosition(@NotNull Vector3<? extends Number> vector)
Sets the position of the entity without the need of a Position, this maintains the world that the entity is inboolean
setPosition(@NotNull Position<? extends Number> position)
Sets the position for the entity to be in.default boolean
setPosition(@NotNull Positionable<? extends Position<? extends Number>> positionable)
setRoll(double value)
Sets the Roll of the entities rotation.setVelocity(double x, double y, double z)
Sets the velocity of the entity without the need of a VectorsetVelocity(Vector3<Double> velocity)
Sets the velocity of the entitysetYaw(double value)
Sets the Yaw of the entities rotation
-
Method Details
-
addPassengers
Adds passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.- Parameters:
entities
- Collection of entities to add- Returns:
- itself for chaining
-
addPassengers
Adds passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.- Parameters:
entities
- Collection of entities to add- Returns:
- itself for chaining
-
clearPassengers
Removes all passengers from the entity- Returns:
- itself for chaining
-
createSnapshot
EntitySnapshot<? extends LiveEntity> createSnapshot()Create a snapshot of this instance of the entity- Returns:
- The created snapshot
-
getAttachedTo
Gets the block that the entity is attached to, this could be the block that the entity is standing on- Returns:
- The attached block if present
-
setCustomName
-
setCustomName
-
getCustomNameComponent
Optional<net.kyori.adventure.text.Component> getCustomNameComponent() -
getFacingDirection
Gets the position the entity is facing in as a Direction- Returns:
- A direction of the entities facing direction
-
getPassengers
Collection<T> getPassengers()Gets the passengers of the entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of the entity, if a snapshot is created of a live entity then the passengers will be stored with the created snapshot. And restored as different instances when the snapshot is restored- Returns:
- A collection of all passengers
-
getPitch
double getPitch()Gets the current pitch of the entity- Returns:
- the current pitch of the entity
-
setPitch
Sets the pitch of the entities rotation- Parameters:
value
- The pitch to be- Returns:
- Itself for chaining
-
getPosition
SyncExactPosition getPosition()Gets the position the entity is.- Specified by:
getPosition
in interfacePositionable<T extends Entity<?>>
- Returns:
- The Exact Position the entity is
-
getRoll
double getRoll()Gets the roll of the entity, note that as Bukkit does not support roll, then the result will be 0- Returns:
- The roll of the entity
-
setRoll
Sets the Roll of the entities rotation. Note that bukkit does not support roll, therefore there will be no result in Bukkit- Parameters:
value
- the roll to be- Returns:
- Itself for chaining
-
getType
Gets the type of the entity- Type Parameters:
E
- Itself as a LiveEntity- Returns:
- The Entity Type
-
getVelocity
Gets the current velocity of the entity- Returns:
- The current velocity
-
setVelocity
Sets the velocity of the entity- Parameters:
velocity
- the velocity to be- Returns:
- itself for chaining
-
getYaw
double getYaw()Gets the yaw of the current entity- Returns:
- the current yaw of the entity
-
setYaw
Sets the Yaw of the entities rotation- Parameters:
value
- The yaw to be- Returns:
- Itself for chaining
-
hasGravity
boolean hasGravity()Checks if the entity has gravity- Returns:
- if the entity has gravity
-
hasPassengers
default boolean hasPassengers()Checks if this entity has any passengers- Returns:
- if this has passengers
-
isCustomNameVisible
boolean isCustomNameVisible()Checks if the custom name should be visible- Returns:
- if the custom name is visible
-
setCustomNameVisible
Sets if the custom name should be visible- Parameters:
visible
- if the name should be visible- Returns:
- itself for chaining
-
isOnGround
boolean isOnGround()Checks if the entity is on ground- Returns:
- If the entity is on the ground
-
isRemoved
boolean isRemoved() -
removePassengers
Removes passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.- Parameters:
entities
- Collection of entities to remove- Returns:
- itself for chaining
-
removePassengers
Removes passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.- Parameters:
entities
- Collection of entities to remove- Returns:
- itself for chaining
-
setGravity
Sets if the entity has gravity or not- Parameters:
check
- If the entity should have gravity- Returns:
- itself for chaining
-
setPosition
Sets the position for the entity to be in.Note that platforms that hold more then position information in the Position class will be applied to the entity too. Such as, Bukkits Location holds rotation data, therefore this should be set first and then the rotation data.
- Parameters:
position
- The position for the entity to be in- Returns:
- was successful
-
setPosition
Sets the position of the entity without the need of a Position, this maintains the world that the entity is in- Parameters:
vector
- the new position- Returns:
- was successful
-
setPosition
default boolean setPosition(@NotNull @NotNull Positionable<? extends Position<? extends Number>> positionable) -
setPosition
default boolean setPosition(double x, double y, double z)Sets the position of the entity without the need of a Position, this maintains the world that the entity is in- Parameters:
x
- The X position of the worldy
- The Y position of the worldz
- The Z position of the world- Returns:
- info about the teleport
-
setVelocity
Sets the velocity of the entity without the need of a Vector- Parameters:
x
- the X speedy
- the Y speedz
- the Z speed- Returns:
- itself for chaining
-