Creating enchants
Every .yml file inside custom-enchants/ is a new enchant. It is bought and upgraded from the pickaxe menu like the built-in ones, earns mastery, announces its activation and respects the destruction guard. No programming needed.
custom-enchants/README.yml documents every option, and treasure_hunter.yml and shard_storm.yml are working examples. Changes apply on restart.
Full example
# custom-enchants/shard_storm.yml
enabled: true
display-name: "&b◆ Shard Storm"
trigger: POST_BREAK
rarity: LEGENDARY
description:
- "&7Summons a storm that clears a disc"
- "&7and turns the rubble into shards."
- ""
- "&7Radius: &f{value}"
max-level: 100
base-cost: 50
cost-multiplier: 1.06
currency: shards
required-pickaxe-level: 25
gui-slot: 42
gui-item: "PRISMARINE_SHARD"
conflicts-with: []
requires: [treasure_hunter]
level-values:
1: 2
100: 7
chance: "0.02 + {level} * 0.01"
cooldown-ticks: 20
effects:
- type: break
shape: disc
radius: "{value}"
max-blocks: 400
- type: currency
currency: shards
amount: "floor({broken} / 25)"
- type: level-exp
track: player
amount: "{broken} * 0.5"
- type: particle
particle: "ELECTRIC_SPARK|FIREWORKS_SPARK"
count: "min(120, {broken})"
spread: "{radius} / 2"
- type: sound
sound: ENTITY_LIGHTNING_BOLT_THUNDER
volume: 0.4
pitch: 1.6With a chance of 0.03% at level 1 up to 1.02% at level 100 (the formula is in percent), it breaks a disc of radius 2 to 7, pays one shard per 25 broken blocks and gives player track experience.
Options
The id is the file name, unless you set id:.
Shared with enchants.yml: enabled, display-name, trigger, rarity, description, max-level, base-cost, cost-multiplier, currency, required-pickaxe-level, gui-slot, gui-item, conflicts-with, requires, upgradeable, default-enchant, level-values, level-chances. See Enchants.
Custom:
| Option | Does |
|---|---|
chance | Activation chance in %, accepts a formula. Without it level-chances is used, or 100 |
cooldown-ticks | Minimum ticks between activations for the same player |
permission | Permission needed for it to work |
effects | List of effects run in order when it activates |
Triggers: PRE_BREAK before the block is paid (to break more), POST_BREAK after (for rewards) and PASSIVE on every block.
Effects
Every effect accepts chance: to roll on its own, and every number accepts a formula.
| Type | Options | Does |
|---|---|---|
currency | currency, amount, store-as | Pays a currency. Applies the currency:<id> stat |
break | shape, radius, length, max-blocks | Breaks blocks in a shape and pays them like normal mining |
extra-drops | material (or self), amount | Adds extra blocks |
exp-multiplier | multiplier | Multiplies pickaxe experience for this block |
level-exp | track, amount | Gives experience to a levels.yml track |
potion | effect, amplifier, duration (ticks) | Applies a potion effect |
particle | particle, count, spread, at (block or player) | Particles; several names separated by | are tried in order |
sound | sound, volume, pitch | Sound |
actions | actions | Runs actions |
variable | name, value | Stores a value for later effects |
break shapes
| Shape | Breaks |
|---|---|
sphere | A sphere of radius |
cube | A cube of radius |
disc | A horizontal disc of radius |
layer | The whole mine layer at the block's height |
layers | length whole layers downwards |
column | length blocks downwards, radius wide |
line | length blocks in the player's horizontal direction, radius wide |
length defaults to radius.
break respects the guard: it only breaks inside mines or allowed regions, and never more than max-blocks nor max-blocks-per-activation from enchants.yml.
Variables
| Variable | Value |
|---|---|
{level} · {max_level} | Enchant level and maximum |
{value} · {chance} | level-values and level-chances interpolated for the level |
{pickaxe_level} | Pickaxe level |
{broken} | Blocks broken so far by break effects |
{radius} | Radius of the last break |
{reward} | Last amount paid by currency (or the store-as name) |
| Any name | Created with variable or store-as |
In actions, also: {enchant} (name), {block} (material) and every variable as {name}.
Example with variables
effects:
- type: variable
name: bonus
value: "1 + {pickaxe_level} / 100"
- type: currency
currency: tokens
amount: "random(100, 300) * {bonus}"
store-as: paid
- type: actions
chance: 10
actions:
- "[actionbar] &e+{paid} tokens &7from {enchant}"Tips
- Start with low chances and raise them with
level-chancesor a formula with{level}. - For area enchants use
max-blocks: a large radius in a large mine breaks a lot of blocks. - Pay new currencies (
shards) instead of money so the main economy doesn't inflate. - For logic YAML can't express, write a Java enchant. See Extending PulsePrison.