Class EntityWrapper

java.lang.Object
me.deecaad.weaponmechanics.wrappers.EntityWrapper
Direct Known Subclasses:
PlayerWrapper

public class EntityWrapper extends Object
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 Details

    • EntityWrapper

      public EntityWrapper(org.bukkit.entity.LivingEntity livingEntity)
  • Method Details

    • getEntity

      public org.bukkit.entity.LivingEntity getEntity()
    • getMoveTask

      public com.cjcrafter.foliascheduler.TaskImplementation<Void> getMoveTask()
    • isStanding

      public boolean isStanding()
      Returns true when the entity is standing still. Returns false when the entity is moving, swimming, or mid-air.
      Returns:
      true if the entity is standing still.
    • isWalking

      public boolean isWalking()
      Returns true when the entity is moving. Returns false when the entity is standing still, swimming, or mid-air.
      Returns:
      true if the entity is moving.
    • isInMidair

      public boolean isInMidair()
      Returns true when the entity is mid-air (not on the ground). Returns false when the entity is standing still, swimming, or walking.
      Returns:
      true if the entity is mid-air.
    • isSwimming

      public boolean isSwimming()
      Returns true when the entity is swimming (legs and head are both in water, also checks 1.13+ sprint swimming). Returns false when the entity is standing still, mid-air, or walking.
      Returns:
      true if the entity is swimming.
    • isSneaking

      public boolean isSneaking()
      Returns true if the entity is a player, and the player is in sneak mode.
      Returns:
      true when the player is sneaking.
      See Also:
      • Player.isSneaking()
    • isSprinting

      public boolean isSprinting()
      Returns true if the entity is a player, and the player is sprinting.
      Returns:
      true when the player is sprinting.
      See Also:
      • Player.isSprinting()
    • isGliding

      public boolean isGliding()
      Returns true if the entity is gliding using an elytra. Apparently, non-player entities CAN glide.
      Returns:
      true when the entity is gliding.
      See Also:
      • LivingEntity.isGliding()
    • isRightClicking

      public boolean isRightClicking()
      Returns true if 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:
      true when the player is right-clicking.
      See Also:
      • HumanEntity.isBlocking()
    • isDualWielding

      public boolean isDualWielding()
      Returns true if the entity is dual wielding, meaning when they have items equipped in both hands.
      Returns:
      true when the entity is dual wielding.
    • isDualWieldingWeapons

      public boolean isDualWieldingWeapons()
      Returns true if the entity is dual wielding two weapons from WeaponMechanics.
      Returns:
      true when the entity is dual wielding two weapons.
      See Also:
    • isRiding

      public boolean isRiding()
      Returns:
      true when the entity is riding.
    • getHandData

      @NotNull public HandData getHandData(boolean mainHand)
    • getMainHandData

      @NotNull public HandData getMainHandData()
    • getOffHandData

      @NotNull public HandData getOffHandData()
    • isReloading

      public boolean isReloading()
    • isZooming

      public boolean isZooming()
    • isAmmoEmpty

      public boolean isAmmoEmpty()
    • isPlayer

      public boolean isPlayer()