API reference / @jsprismarine/prismarine / enchantment/melee
enchantment/melee
Interfaces
MeleeEnchantmentBonus
Defined in: packages/prismarine/src/enchantment/melee.ts:37
What the weapon's enchantments are worth on one swing.
Properties
damage
readonlydamage:number
Defined in: packages/prismarine/src/enchantment/melee.ts:39
Half-hearts on top of the base, before the critical multiplier.
knockbackLevels
readonlyknockbackLevels:number
Defined in: packages/prismarine/src/enchantment/melee.ts:41
Knockback levels on top of the sprint.
MeleeEnchantmentInput
Defined in: packages/prismarine/src/enchantment/melee.ts:23
What one swing is worked out from.
Properties
content
readonlycontent:ServerContent|undefined
Defined in: packages/prismarine/src/enchantment/melee.ts:25
The content build, or undefined when the server has none.
source
readonlysource:LootKill
Defined in: packages/prismarine/src/enchantment/melee.ts:33
The blow, as the damage source predicates read it.
victim
readonlyvictim:ViewableEntity
Defined in: packages/prismarine/src/enchantment/melee.ts:29
Who is being hit.
victimEquipment?
readonlyoptionalvictimEquipment?:ViewableEquipment
Defined in: packages/prismarine/src/enchantment/melee.ts:31
What the victim is wearing, which the victim's own conditions read.
weapon
readonlyweapon:Item|undefined
Defined in: packages/prismarine/src/enchantment/melee.ts:27
The stack doing the hitting, or undefined for a bare hand.
Functions
meleeEnchantmentBonus()
meleeEnchantmentBonus(
input,base):MeleeEnchantmentBonus
Defined in: packages/prismarine/src/enchantment/melee.ts:57
The bonus one swing carries.
Parameters
input
base
number
The weapon's own damage, which minecraft:damage folds over. The bonus is the difference, because Java scales the base by the attack charge and the enchantment part linearly - see attackDamage in @jsprismarine/item-behaviors.
Returns
Zeroes when the server built no content, when the hand is empty, or when the weapon carries no enchantment.
meleePostAttackEffects()
meleePostAttackEffects(
input,random?): readonlyEffectRun[]
Defined in: packages/prismarine/src/enchantment/melee.ts:84
The post_attack effects a landed blow sets off: the weapon's, which Fire Aspect's ignite is among, and the victim's armor's, which Thorns' hurt is among.
Parameters
input
random?
Returns
readonly EffectRun[]
Each effect with the side it acts on.
Java See
EnchantmentHelper.doPostAttackEffects