Interface CombatService


public interface CombatService
  • Method Details

    • attack

      boolean attack(Player attacker, Entity target)
      Parameters:
      attacker - the player who swung
      target - the entity being hit
      Returns:
      true if damage was actually dealt
      Since:
      0.1.0
    • damage

      boolean damage(LivingEntity target, DamageSource source, float amount)
      Parameters:
      target - the entity taking the hit
      source - the origin of the damage
      amount - damage in half-hearts before reduction; values <= 0 are ignored
      Returns:
      true if health or absorption was actually removed
      Since:
      0.1.0
    • knockback

      void knockback(LivingEntity target, double strength, double fromX, double fromZ)
      Parameters:
      target - the entity to push
      strength - the horizontal knockback strength; <= 0 does nothing
      fromX - the x coordinate the push originates from
      fromZ - the z coordinate the push originates from
      Since:
      0.1.0
    • kill

      void kill(LivingEntity target, @Nullable Entity killer)
      Parameters:
      target - the entity to kill
      killer - the entity credited with the kill, or null
      Since:
      0.1.0
    • attackDamage

      float attackDamage(Player attacker)
      Parameters:
      attacker - the attacking player
      Returns:
      the damage this player's current weapon deals on a fully charged hit
      Since:
      0.1.0
    • attackKnockback

      double attackKnockback(Player attacker)
      Parameters:
      attacker - the attacking player
      Returns:
      the knockback strength applied by this player's hits
      Since:
      0.1.0
    • attackStrengthScale

      float attackStrengthScale(Player attacker)
      Parameters:
      attacker - the attacking player
      Returns:
      the charge of the next hit, between 0.2 and 1
      Since:
      0.1.0
    • attackCooldownTicks

      int attackCooldownTicks(Player attacker)
      Parameters:
      attacker - the attacking player
      Returns:
      the ticks a fully charged swing takes to recharge, derived from attack speed
      Since:
      0.1.0
    • pvpEnabled

      boolean pvpEnabled()
      Returns:
      true when players are allowed to damage each other
      Since:
      0.1.0