Skip to content

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 ​

readonly damage: number

Defined in: packages/prismarine/src/enchantment/melee.ts:39

Half-hearts on top of the base, before the critical multiplier.

knockbackLevels ​

readonly knockbackLevels: 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 ​

readonly content: ServerContent | undefined

Defined in: packages/prismarine/src/enchantment/melee.ts:25

The content build, or undefined when the server has none.

source ​

readonly source: LootKill

Defined in: packages/prismarine/src/enchantment/melee.ts:33

The blow, as the damage source predicates read it.

victim ​

readonly victim: ViewableEntity

Defined in: packages/prismarine/src/enchantment/melee.ts:29

Who is being hit.

victimEquipment? ​

readonly optional victimEquipment?: ViewableEquipment

Defined in: packages/prismarine/src/enchantment/melee.ts:31

What the victim is wearing, which the victim's own conditions read.

weapon ​

readonly weapon: 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 ​

MeleeEnchantmentInput

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 ​

MeleeEnchantmentBonus

Zeroes when the server built no content, when the hand is empty, or when the weapon carries no enchantment.


meleePostAttackEffects() ​

meleePostAttackEffects(input, random?): readonly EffectRun[]

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 ​

MeleeEnchantmentInput

random? ​

RandomSource

Returns ​

readonly EffectRun[]

Each effect with the side it acts on.

Java See ​

EnchantmentHelper.doPostAttackEffects