Skip to content

API reference / @jsprismarine/prismarine / enchantment/mending

enchantment/mending ​

Interfaces ​

ExperienceRepair ​

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

What an orb's points did to a player's gear.

Properties ​

remaining ​

readonly remaining: number

Defined in: packages/prismarine/src/enchantment/mending.ts:35

The points left for the player's experience.

repaired ​

readonly repaired: ReadonlyMap<"head" | "chest" | "feet" | "mainhand" | "offhand" | "legs", Item>

Defined in: packages/prismarine/src/enchantment/mending.ts:37

Each stack that was repaired, by slot, as it now is.

Type Aliases ​

RepairSlot ​

RepairSlot = typeof REPAIR_SLOTS[number]

Defined in: packages/prismarine/src/enchantment/mending.ts:30

One of REPAIR_SLOTS.

Variables ​

REPAIR_SLOTS ​

const REPAIR_SLOTS: readonly ["mainhand", "offhand", "feet", "legs", "chest", "head"]

Defined in: packages/prismarine/src/enchantment/mending.ts:20

The order Java's EquipmentSlot.values() visits a player's slots in.

Java Source ​

EquipmentSlot.$values

Functions ​

repairWithExperience() ​

repairWithExperience(registry, gear, points, randomInt): ExperienceRepair

Defined in: packages/prismarine/src/enchantment/mending.ts:54

Spends an orb's points on the player's damaged gear whose enchantments repair with experience, Java's repairPlayerItems: a random pick among every such stack and enchantment, the points turned into durability by the stack's repair_with_xp effects, and what the repair left over spent on the next pick. A pick that repairs nothing uses up every point, as Java's does.

Parameters ​

registry ​

EnchantmentRegistry

The enchantment definitions, which declare repair_with_xp.

gear ​

Readonly<Partial<Record<RepairSlot, Item | null>>>

What the player has in each slot.

points ​

number

The orb's points.

randomInt ​

(bound) => number

Draws an integer in [0, bound), the player's random in Java.

Returns ​

ExperienceRepair