Class EntityWrapper
java.lang.Object
me.deecaad.weaponmechanics.wrappers.EntityWrapper
- Direct Known Subclasses:
PlayerWrapper
Wraps a
LivingEntity object to simplify per-entity data/methods that are used by
WeaponMechanics. Also contains useful API functionality for plugins who want to check if an
entity is scoped, reloading, etc.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.entity.LivingEntitygetHandData(boolean mainHand) com.cjcrafter.foliascheduler.TaskImplementation<Void> booleanbooleanReturnstrueif the entity is dual wielding, meaning when they have items equipped in both hands.booleanReturnstrueif the entity is dual wielding two weapons from WeaponMechanics.booleanReturnstrueif the entity is gliding using an elytra.booleanReturnstruewhen the entity is mid-air (not on the ground).booleanisPlayer()booleanbooleanisRiding()booleanReturnstrueif the entity is a player, and the player has right-clicked in the past 4 ticks (+- 25 milliseconds).booleanReturnstrueif the entity is a player, and the player is in sneak mode.booleanReturnstrueif the entity is a player, and the player is sprinting.booleanReturnstruewhen the entity is standing still.booleanReturnstruewhen the entity is swimming (legs and head are both in water, also checks 1.13+ sprint swimming).booleanReturnstruewhen the entity is moving.boolean
-
Constructor Details
-
EntityWrapper
public EntityWrapper(org.bukkit.entity.LivingEntity livingEntity)
-
-
Method Details
-
getEntity
public org.bukkit.entity.LivingEntity getEntity() -
getMoveTask
-
isStanding
public boolean isStanding()Returnstruewhen the entity is standing still. Returnsfalsewhen the entity is moving, swimming, or mid-air.- Returns:
trueif the entity is standing still.
-
isWalking
public boolean isWalking()Returnstruewhen the entity is moving. Returnsfalsewhen the entity is standing still, swimming, or mid-air.- Returns:
trueif the entity is moving.
-
isInMidair
public boolean isInMidair()Returnstruewhen the entity is mid-air (not on the ground). Returnsfalsewhen the entity is standing still, swimming, or walking.- Returns:
trueif the entity is mid-air.
-
isSwimming
public boolean isSwimming()Returnstruewhen the entity is swimming (legs and head are both in water, also checks 1.13+ sprint swimming). Returnsfalsewhen the entity is standing still, mid-air, or walking.- Returns:
trueif the entity is swimming.
-
isSneaking
public boolean isSneaking()Returnstrueif the entity is a player, and the player is in sneak mode.- Returns:
truewhen the player is sneaking.- See Also:
-
isSprinting
public boolean isSprinting()Returnstrueif the entity is a player, and the player is sprinting.- Returns:
truewhen the player is sprinting.- See Also:
-
isGliding
public boolean isGliding()Returnstrueif the entity is gliding using an elytra. Apparently, non-player entities CAN glide.- Returns:
truewhen the entity is gliding.- See Also:
-
isRightClicking
public boolean isRightClicking()Returnstrueif the entity is a player, and the player has right-clicked in the past 4 ticks (+- 25 milliseconds). This method also considers the player's ping (Player.getPing()) to determine if they are still right-clicking.While this method is usually quite inaccurate (can be up to 4 ticks late!), it is 100% accurate when the player is blocking (swords in 1.8, shields in 1.9+).
- Returns:
truewhen the player is right-clicking.- See Also:
-
isDualWielding
public boolean isDualWielding()Returnstrueif the entity is dual wielding, meaning when they have items equipped in both hands.- Returns:
truewhen the entity is dual wielding.
-
isDualWieldingWeapons
public boolean isDualWieldingWeapons()Returnstrueif the entity is dual wielding two weapons from WeaponMechanics.- Returns:
truewhen the entity is dual wielding two weapons.- See Also:
-
isRiding
public boolean isRiding()- Returns:
truewhen the entity is riding.
-
getHandData
-
getMainHandData
-
getOffHandData
-
isReloading
public boolean isReloading() -
isZooming
public boolean isZooming() -
isAmmoEmpty
public boolean isAmmoEmpty() -
isPlayer
public boolean isPlayer()
-