QcSwingSpeed Struct
How long one arm swing lasts (decision E-881), shared by the client's animation and the server's cadence of swings while a player mines: the reference's six ticks (300 ms), one tick shorter per level of a hastening effect and two ticks longer per level of a tiring one. More...
| Header: | #include <common/gameplay/QcSwingSpeed.h> |
Public Functions
| int | ticks() const |
Public Variables
| int | extraTicks |
| int | faster |
| int | slower |
Static Public Members
| const int | baseTicks |
| const QStringView | fatigueEffect |
| const QStringView | hasteEffect |
| const int | maxTicks |
| const int | minTicks |
| QcSwingSpeed | of(const QList<QcStatusEffect> &effects) |
Detailed Description
Everything that changes the swing (status effects, a beacon, an enchantment of our own) adds its levels or ticks here, so the animation only ever asks ticks().
Member Function Documentation
[static] QcSwingSpeed QcSwingSpeed::of(const QList<QcStatusEffect> &effects)
Returns the swing of a body with the status effects: haste and mining fatigue by their names, so a pack that defines them changes the swing without any code (none of the base content does).
int QcSwingSpeed::ticks() const
Returns the swing's length in ticks, within minTicks..maxTicks.
Member Variable Documentation
const int QcSwingSpeed::baseTicks
The reference's swing without effects.
int QcSwingSpeed::extraTicks
Any other change in ticks, negative for faster (an enchantment of our own).
int QcSwingSpeed::faster
Levels that shorten the swing by one tick each (haste, a beacon's haste).
const int QcSwingSpeed::maxTicks
Mining fatigue V would be 16; the bound keeps a mod's level 100 from freezing the arm.
const int QcSwingSpeed::minTicks
The shortest swing.
int QcSwingSpeed::slower
Levels that lengthen it by two ticks each (mining fatigue).