Package me.gamercoder215.mobchip
Interface EntityBody
public interface EntityBody
Represents an Entity's Body and Server Attributes
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Represents EquipmentSlots consisting of your Main Hand and Off-Handstatic enum
Represents the result of an interaction -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an entity that this Mob will not collide with.default void
addCollideExemptions
(@NotNull Iterable<Entity> entities) Adds a collection of entities that this Mob will not collide with.default void
addCollideExemptions
(@NotNull Entity... entities) Adds an array of entities that this Mob will not collide with.default void
addRiptideTicks
(int ticks) Adds Riptiding Ticks to the Mob's current Riptiding Ticks.boolean
Whether this Mob can breathe underwater.boolean
Whether this Mob can be ridden underwater.void
Eats an Item.float
Fetches the Mob's current animation speed.float
Fetch the percentage of how much armor is covering this Mob.float
Fetches the Mob's current body rotation (between 0.0F and 360.0F)Fetches a set of all entities that this Mob will not collide with.int
Fetches the total amount of ticks this mob has been dead for, or 0 if not dead.Fetches the entity's current default drops.int
Fetches the amount of experience this Mob will drop.Fetches the entity this body belongs to.float
Fetches how far this Mob has flown.float
Fetches the Mob's current flying speed.float
Fetches the forward speed of this entity.float
Fetches the Mob's current head rotation (between 0.0F and 360.0F)int
Fetches the total amount of ticks this mob has been hurt for.int
Fetches the number of ticks the mob turns red for after being hit, or 0 when not recently hit.Fetches the last position this Entity touchedMaterial.LAVA
.Gets this Mob's Main Hand.int
Fetches the maximum distance this Mob can fall before taking damage.float
Deprecated.Exposed in Minecraft 1.20.5 via Attribute#STEP_HEIGHTfloat
Fetches how far this Mob has moved.float
getPitch()
Fetches the Mob's current pitch (between 0.0F and 360.0F)int
Fetches the Mob's current Riptiding Ticks.float
Fetches the sideways speed of this entity.float
Fetches the upward speed of this entity.float
Fetches how far this Mob has automatically walked.float
getYaw()
Fetches the Mob's current yaw (between 0.0F and 360.0F)boolean
Whether this Mob has horizontal collision enabled.boolean
Whether this Mob has vertical collision enabled.Makes this Mob interact with a Player.boolean
Whether this Mob is affected by Potions.boolean
Whether this Mob is blocking.boolean
Whether this Mob is Immune to Fire/Lava Damage.boolean
Whether the Mob is currently forced to drop its loot.boolean
Whether this Entity is immune to explosions.boolean
Whether this Mob is currently in a Bubble Column.boolean
Deprecated.UseEntityCombatTracker.isInCombat()
instead.boolean
Fetches whether this Entity is currently inside an Unloaded Chunk.boolean
Whether this Mob is invisible to this Player.boolean
Whether this Mob is immune to being damaged by this DamageCause.boolean
Whether this Entity is Left Handed.boolean
isMoving()
Whether this Mob is currently moving.boolean
Whether this Mob can be spawned in Peaceful Mode,boolean
isPushableBy
(@Nullable Entity entity) Whether this Mob is pushable by this entity.default boolean
Whether this Mob is currently riptiding.boolean
Whether this Entity is sensitive to water (e.g.boolean
Whether this Mob is swinging its arm.boolean
Whether this Mob is currently using an Item.void
naturalKnockback
(double force, double xForce, double zForce) Performs a natural knockback on this Entity.static float
normalizeRotation
(float rotation) Utility Method to normalize the rotation value to be within0.0F
and360.0F
.void
Makes this Mob perform an Animation.void
Removes an entity that this Mob will not collide with.void
Resets the distance this Entity has fallen.void
Sends this Entity to the specified Player as a packet.void
setAnimationSpeed
(float speed) Sets the Mob's current animation speed.void
setBodyRotation
(float rotation) Sets the Mob's current body rotation.void
setDeathTime
(int deathTime) Sets the total amount of ticks this mob has been dead for.default void
setDefaultDrops
(@Nullable Iterable<ItemStack> drops) Sets the entity's current default drops.default void
setDefaultDrops
(@Nullable Material... drops) Sets the entity's current default drops.void
setDefaultDrops
(@Nullable ItemStack... drops) Sets the entity's current default drops.void
setDiscardFriction
(boolean discard) Sets whether this Mob should discard friction.void
setDroppedExperience
(int exp) Sets the amount of experience this Mob will drop.void
setFlyingSpeed
(float speed) Sets the Mob's current flying speed.void
setForcingDrops
(boolean drop) Sets if the Mob should be forced to drop its loot.void
setForwardSpeed
(float speed) Sets the forward speed of this entity.void
setHeadRotation
(float rotation) Sets the Mob's current head rotation.void
setHorizontalCollision
(boolean collision) Sets if this Mob has horizontal collision enabled.void
setHurtDuration
(int hurtDuration) Sets the total amount of ticks this mob has been hurt for.void
setHurtTime
(int hurtTime) Sets the number of ticks the mob turns red for after being hit.void
setLeftHanded
(boolean leftHanded) Sets this Entity to be left-handed.void
setMaxUpStep
(float maxUpStep) Deprecated.Exposed in Minecraft 1.20.5 via Attribute#STEP_HEIGHTvoid
setPitch
(float rotation) Sets the Mob's current pitch.void
setRiptideTicks
(int ticks) Sets the Mob's Riptiding Ticks.void
setRotation
(float yaw, float pitch) Sets the Entity's Rotation.void
setSidewaysSpeed
(float speed) Sets the sideways speed of this entity.void
setUpwardSpeed
(float speed) Sets the upward speed of this entity.void
setVerticalCollision
(boolean collision) Sets if this Mob has vertical collision enabled.void
setYaw
(float rotation) Sets the Mob's current yaw.boolean
Whether this Mob should discard friction.default boolean
shouldRenderFrom
(double dist) Whether the entity would render.boolean
shouldRenderFrom
(double x, double y, double z) Whether the entity would render at this location.default boolean
Whether the entity would render at this location.boolean
shouldRenderFromSqr
(double dist) Whether the entity would render.default void
Makes this Mob stop riptiding.void
Makes this Mob use the Item in its Hand.
-
Method Details
-
isLeftHanded
boolean isLeftHanded()Whether this Entity is Left Handed.- Returns:
- true if left-handed, else false
-
setLeftHanded
void setLeftHanded(boolean leftHanded) Sets this Entity to be left-handed.- Parameters:
leftHanded
- true if left-handed, else false
-
canBreatheUnderwater
boolean canBreatheUnderwater()Whether this Mob can breathe underwater.- Returns:
- true if mob can breathe underwater, else false
-
shouldDiscardFriction
boolean shouldDiscardFriction()Whether this Mob should discard friction.If this is set to true, the entity's movement will not be amplified while naturally traveling.
- Returns:
- true if mob discards friction, else false
-
setDiscardFriction
void setDiscardFriction(boolean discard) Sets whether this Mob should discard friction. SeeshouldDiscardFriction()
for more information on what this actually does.- Parameters:
discard
- true if mob discards friction, else false- See Also:
-
interact
EntityBody.InteractionResult interact(@NotNull @NotNull Player p, @Nullable @Nullable EntityBody.InteractionHand hand) Makes this Mob interact with a Player.- Parameters:
p
- Player to interact withhand
- Hand to use- Returns:
- Result of interaction
-
isSensitiveToWater
boolean isSensitiveToWater()Whether this Entity is sensitive to water (e.g. enderman)- Returns:
- true if sensitive to water, else false
-
isAffectedByPotions
boolean isAffectedByPotions()Whether this Mob is affected by Potions.- Returns:
- true if mob is affected, else false
-
isBlocking
boolean isBlocking()Whether this Mob is blocking.- Returns:
- true if mob is blocking, else false
-
getArmorCoverPercentage
float getArmorCoverPercentage()Fetch the percentage of how much armor is covering this Mob.- Returns:
- Percentage of Armor Coverage
-
useItem
Makes this Mob use the Item in its Hand.- Parameters:
hand
- Hand to use
-
isUsingItem
boolean isUsingItem()Whether this Mob is currently using an Item.- Returns:
- true if mob is using item, else false
-
isFireImmune
boolean isFireImmune()Whether this Mob is Immune to Fire/Lava Damage.- Returns:
- true if Mob is immune to fire, else false
-
isSwinging
boolean isSwinging()Whether this Mob is swinging its arm.- Returns:
- true if mob is swinging its arm, else false
-
canRideUnderwater
boolean canRideUnderwater()Whether this Mob can be ridden underwater.- Returns:
- true if mob can be ridden underwater, else false
-
isInvisibleTo
Whether this Mob is invisible to this Player.- Parameters:
p
- Player to use- Returns:
- true if mob is invisible to this player, else false
-
getMainHand
Gets this Mob's Main Hand.- Returns:
- Mob's Main Hand
-
getDefaultDrops
Fetches the entity's current default drops.- Returns:
- List of Default Drops
-
setDefaultDrops
Sets the entity's current default drops.- Parameters:
drops
- Array of Default Drops
-
setDefaultDrops
Sets the entity's current default drops.- Parameters:
drops
- Iterable of Default Drops
-
setDefaultDrops
Sets the entity's current default drops.- Parameters:
drops
- Array of Default Drops
-
isInCombat
Deprecated.UseEntityCombatTracker.isInCombat()
instead.Whether this Mob is currently in combat.- Returns:
- true if mob is in combat, else false
-
getFlyingSpeed
float getFlyingSpeed()Fetches the Mob's current flying speed.- Returns:
- Current Flying Speed (between 0.0F and 1.0F)
-
setFlyingSpeed
Sets the Mob's current flying speed.- Parameters:
speed
- Flying Speed to set- Throws:
IllegalArgumentException
- if speed is not between 0.0F and 1.0F
-
isForcingDrops
boolean isForcingDrops()Whether the Mob is currently forced to drop its loot.- Returns:
- true if mob is forced to drop loot, else false
-
setForcingDrops
void setForcingDrops(boolean drop) Sets if the Mob should be forced to drop its loot.- Parameters:
drop
- true if mob is forced to drop loot, else false
-
isMoving
boolean isMoving()Whether this Mob is currently moving.- Returns:
- true if mob is moving, else false
-
normalizeRotation
static float normalizeRotation(float rotation) Utility Method to normalize the rotation value to be within0.0F
and360.0F
.- Parameters:
rotation
- Rotation to normalize- Returns:
- Normalized Rotation
-
getBodyRotation
float getBodyRotation()Fetches the Mob's current body rotation (between 0.0F and 360.0F)- Returns:
- Current Body Rotation
-
setBodyRotation
void setBodyRotation(float rotation) Sets the Mob's current body rotation.
If the rotation is not between 0.0F and 360.0F, it will be wrapped to be between 0.0F and 360.0F (e.g. 480.0F = 120.0F).- Parameters:
rotation
- Body Rotation to set
-
getHeadRotation
float getHeadRotation()Fetches the Mob's current head rotation (between 0.0F and 360.0F)- Returns:
- Current Head Rotation
-
setHeadRotation
void setHeadRotation(float rotation) Sets the Mob's current head rotation.
If the rotation is not between 0.0F and 360.0F, it will be wrapped to be between 0.0F and 360.0F (e.g. 480.0F = 120.0F).- Parameters:
rotation
- Head Rotation to set
-
getYaw
float getYaw()Fetches the Mob's current yaw (between 0.0F and 360.0F)- Returns:
- Current Yaw
-
setYaw
void setYaw(float rotation) Sets the Mob's current yaw.
If the rotation is not between 0.0F and 360.0F, it will be wrapped to be between 0.0F and 360.0F (e.g. 480.0F = 120.0F).- Parameters:
rotation
- Yaw to set
-
getPitch
float getPitch()Fetches the Mob's current pitch (between 0.0F and 360.0F)- Returns:
- Current Pitch
-
setPitch
void setPitch(float rotation) Sets the Mob's current pitch.
If the rotation is not between 0.0F and 360.0F, it will be wrapped to be between 0.0F and 360.0F (e.g. 480.0F = 120.0F).- Parameters:
rotation
- Pitch to set
-
getCollideExemptions
Fetches a set of all entities that this Mob will not collide with.- Returns:
- Entities that this Mob will not collide with
-
addCollideExemption
Adds an entity that this Mob will not collide with.- Parameters:
en
- Entity to add- Throws:
IllegalArgumentException
- if entity is null
-
addCollideExemptions
default void addCollideExemptions(@NotNull @NotNull Entity... entities) throws IllegalArgumentException Adds an array of entities that this Mob will not collide with.- Parameters:
entities
- Entities to add- Throws:
IllegalArgumentException
- if entities or any entity is null
-
addCollideExemptions
default void addCollideExemptions(@NotNull @NotNull Iterable<Entity> entities) throws IllegalArgumentException Adds a collection of entities that this Mob will not collide with.- Parameters:
entities
- Entities to add- Throws:
IllegalArgumentException
- if entities or any entity is null
-
removeCollideExemption
Removes an entity that this Mob will not collide with.- Parameters:
en
- Entity to remove- Throws:
IllegalArgumentException
- if entity is null
-
getDroppedExperience
int getDroppedExperience()Fetches the amount of experience this Mob will drop.- Returns:
- Amount of Experience
-
setDroppedExperience
Sets the amount of experience this Mob will drop.- Parameters:
exp
- Experience Dropped- Throws:
IllegalArgumentException
- if experience is less than 0
-
playAnimation
Makes this Mob perform an Animation.- Parameters:
anim
- Animation to perform
-
getAnimationSpeed
float getAnimationSpeed()Fetches the Mob's current animation speed.- Returns:
- Current Animation Speed
-
setAnimationSpeed
Sets the Mob's current animation speed.- Parameters:
speed
- Animation Speed to set- Throws:
IllegalArgumentException
- if speed is less than 0.0F
-
hasVerticalCollision
boolean hasVerticalCollision()Whether this Mob has vertical collision enabled.- Returns:
- true if mob has vertical collision, else false
-
setVerticalCollision
void setVerticalCollision(boolean collision) Sets if this Mob has vertical collision enabled.- Parameters:
collision
- true if mob has vertical collision, else false
-
hasHorizontalCollision
boolean hasHorizontalCollision()Whether this Mob has horizontal collision enabled.- Returns:
- true if mob has horizontal collision, else false
-
setHorizontalCollision
void setHorizontalCollision(boolean collision) Sets if this Mob has horizontal collision enabled.- Parameters:
collision
- true if mob has horizontal collision, else false
-
getWalkDistance
float getWalkDistance()Fetches how far this Mob has automatically walked.- Returns:
- Walking Distance
-
getMoveDistance
float getMoveDistance()Fetches how far this Mob has moved.- Returns:
- Movement Distance
-
getFlyDistance
float getFlyDistance()Fetches how far this Mob has flown.- Returns:
- Flying Distance
-
isImmuneToExplosions
boolean isImmuneToExplosions()Whether this Entity is immune to explosions.- Returns:
- true if immune, else false
-
isPeacefulCompatible
boolean isPeacefulCompatible()Whether this Mob can be spawned in Peaceful Mode,- Returns:
- true if peaceful, else false
-
isInBubbleColumn
boolean isInBubbleColumn()Whether this Mob is currently in a Bubble Column.- Returns:
- true if in bubble column, else false
-
isInvulnerableTo
Whether this Mob is immune to being damaged by this DamageCause.- Parameters:
cause
- DamageCause to check- Returns:
- true if immune, else false
-
getMaxFallDistance
int getMaxFallDistance()Fetches the maximum distance this Mob can fall before taking damage.- Returns:
- Maximum Fall Distance
-
isPushableBy
Whether this Mob is pushable by this entity.- Parameters:
entity
- Entity to check- Returns:
- true if entity can push this mob, else false
-
getMaxUpStep
Deprecated.Exposed in Minecraft 1.20.5 via Attribute#STEP_HEIGHTFetches the maximum block height this entity can walk up without jumping.- Returns:
- Maximum step height
-
setMaxUpStep
Deprecated.Exposed in Minecraft 1.20.5 via Attribute#STEP_HEIGHTSets the maximum block height this entity can walk up without jumping.- Parameters:
maxUpStep
- Maximum step height
-
getLastLavaContact
Position getLastLavaContact()Fetches the last position this Entity touchedMaterial.LAVA
.- Returns:
- Last Lava Position
-
setRiptideTicks
Sets the Mob's Riptiding Ticks.
The mob will begin riptiding if
isRiptiding()
returns false, and the number is greater than 0.- Parameters:
ticks
- Riptiding Ticks to set- Throws:
IllegalArgumentException
- if ticks is negative
-
stopRiptiding
default void stopRiptiding()Makes this Mob stop riptiding. -
addRiptideTicks
Adds Riptiding Ticks to the Mob's current Riptiding Ticks.- Parameters:
ticks
- Riptiding Ticks to add- Throws:
IllegalArgumentException
- if ticks is negative
-
getRiptideTicks
int getRiptideTicks()Fetches the Mob's current Riptiding Ticks.- Returns:
- Current Riptiding Ticks
-
isRiptiding
default boolean isRiptiding()Whether this Mob is currently riptiding.- Returns:
- true if riptiding, else false
-
getEntity
Fetches the entity this body belongs to.- Returns:
- Body Owner
-
shouldRenderFrom
boolean shouldRenderFrom(double x, double y, double z) Whether the entity would render at this location.- Parameters:
x
- X Coordinatey
- Y Coordinatez
- Z Coordinate- Returns:
- true if entity would render, else false
-
shouldRenderFrom
Whether the entity would render at this location.- Parameters:
l
- Location to check- Returns:
- true if entity would render, else false
-
shouldRenderFrom
default boolean shouldRenderFrom(double dist) Whether the entity would render.- Parameters:
dist
- Distance from entity- Returns:
- true if entity would render, else false
-
shouldRenderFromSqr
boolean shouldRenderFromSqr(double dist) Whether the entity would render.- Parameters:
dist
- Square Distance from entity- Returns:
- true if entity would render, else false
-
sendTo
Sends this Entity to the specified Player as a packet.- Parameters:
p
- Player to send to- Throws:
UnsupportedOperationException
- if this Entity cannot be sent as a packet
-
resetFallDistance
void resetFallDistance()Resets the distance this Entity has fallen. -
isInUnloadedChunk
boolean isInUnloadedChunk()Fetches whether this Entity is currently inside an Unloaded Chunk.- Returns:
- true if in unloaded chunk, else false
-
naturalKnockback
void naturalKnockback(double force, double xForce, double zForce) Performs a natural knockback on this Entity.- Parameters:
force
- Force of knockback to influence X and ZxForce
- X Direction ForcezForce
- Z Direction Force
-
eat
Eats an Item.- Parameters:
item
- Item to eat
-
setRotation
void setRotation(float yaw, float pitch) Sets the Entity's Rotation.- Parameters:
yaw
- Yaw to setpitch
- Pitch to set
-
getHurtTime
int getHurtTime()Fetches the number of ticks the mob turns red for after being hit, or 0 when not recently hit.- Returns:
- Hurt Time
-
setHurtTime
void setHurtTime(int hurtTime) Sets the number of ticks the mob turns red for after being hit.- Parameters:
hurtTime
- Hurt Time to set
-
getHurtDuration
int getHurtDuration()Fetches the total amount of ticks this mob has been hurt for.- Returns:
- Hurt Duration
-
setHurtDuration
void setHurtDuration(int hurtDuration) Sets the total amount of ticks this mob has been hurt for.- Parameters:
hurtDuration
- Hurt Duration to set
-
getDeathTime
int getDeathTime()Fetches the total amount of ticks this mob has been dead for, or 0 if not dead.- Returns:
- Death Time
-
setDeathTime
void setDeathTime(int deathTime) Sets the total amount of ticks this mob has been dead for.- Parameters:
deathTime
- Death Time to set
-
getForwardSpeed
float getForwardSpeed()Fetches the forward speed of this entity.- Returns:
- Forward Speed
-
setForwardSpeed
void setForwardSpeed(float speed) Sets the forward speed of this entity.- Parameters:
speed
- Forward Speed to set
-
getSidewaysSpeed
float getSidewaysSpeed()Fetches the sideways speed of this entity.- Returns:
- Sideways Speed
-
setSidewaysSpeed
void setSidewaysSpeed(float speed) Sets the sideways speed of this entity.- Parameters:
speed
- Sideways Speed to set
-
getUpwardSpeed
float getUpwardSpeed()Fetches the upward speed of this entity.- Returns:
- Upward Speed
-
setUpwardSpeed
void setUpwardSpeed(float speed) Sets the upward speed of this entity.- Parameters:
speed
- Upward Speed to set
-