Interface CombatService
public interface CombatService
-
Method Summary
Modifier and TypeMethodDescriptionbooleanintattackCooldownTicks(Player attacker) floatattackDamage(Player attacker) doubleattackKnockback(Player attacker) floatattackStrengthScale(Player attacker) booleandamage(LivingEntity target, DamageSource source, float amount) voidkill(LivingEntity target, @Nullable Entity killer) voidknockback(LivingEntity target, double strength, double fromX, double fromZ) boolean
-
Method Details
-
attack
-
damage
- Parameters:
target- the entity taking the hitsource- the origin of the damageamount- damage in half-hearts before reduction; values<= 0are ignored- Returns:
trueif health or absorption was actually removed- Since:
- 0.1.0
-
knockback
- Parameters:
target- the entity to pushstrength- the horizontal knockback strength;<= 0does nothingfromX- the x coordinate the push originates fromfromZ- the z coordinate the push originates from- Since:
- 0.1.0
-
kill
- Parameters:
target- the entity to killkiller- the entity credited with the kill, ornull- Since:
- 0.1.0
-
attackDamage
- Parameters:
attacker- the attacking player- Returns:
- the damage this player's current weapon deals on a fully charged hit
- Since:
- 0.1.0
-
attackKnockback
- Parameters:
attacker- the attacking player- Returns:
- the knockback strength applied by this player's hits
- Since:
- 0.1.0
-
attackStrengthScale
- Parameters:
attacker- the attacking player- Returns:
- the charge of the next hit, between
0.2and1 - Since:
- 0.1.0
-
attackCooldownTicks
- 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:
truewhen players are allowed to damage each other- Since:
- 0.1.0
-