Docs

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

yaml
# 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.6

With 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:

OptionDoes
chanceActivation chance in %, accepts a formula. Without it level-chances is used, or 100
cooldown-ticksMinimum ticks between activations for the same player
permissionPermission needed for it to work
effectsList 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.

TypeOptionsDoes
currencycurrency, amount, store-asPays a currency. Applies the currency:<id> stat
breakshape, radius, length, max-blocksBreaks blocks in a shape and pays them like normal mining
extra-dropsmaterial (or self), amountAdds extra blocks
exp-multipliermultiplierMultiplies pickaxe experience for this block
level-exptrack, amountGives experience to a levels.yml track
potioneffect, amplifier, duration (ticks)Applies a potion effect
particleparticle, count, spread, at (block or player)Particles; several names separated by | are tried in order
soundsound, volume, pitchSound
actionsactionsRuns actions
variablename, valueStores a value for later effects

break shapes

ShapeBreaks
sphereA sphere of radius
cubeA cube of radius
discA horizontal disc of radius
layerThe whole mine layer at the block's height
layerslength whole layers downwards
columnlength blocks downwards, radius wide
linelength 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

VariableValue
{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 nameCreated with variable or store-as

In actions, also: {enchant} (name), {block} (material) and every variable as {name}.

Example with variables

yaml
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-chances or 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.
Creating enchants | PulsePrison Core Docs