Quick Start
Initial Configuration
Some key configuration steps to get started focus on the datapack deployment and the world(s) you want it present in. This can be found in the /plugins/MythicEnchants/config.yml file:
datapack:
enabled: true
auto-generate: true
install-on-startup: true
datapack-name: "MythicEnchants"
# If left blank, installs to all loaded worlds dynamically.
# Otherwise, list specific world names below.
worlds: []
# - "world"
regenerate-on-reload: true
# We NEVER run /reload. Auto-reload will never be an option.
max-backups: 0
If it is your first time starting the server since installing MythicEnchants, your enchantment datapack has not taken effect yet. Configure the world(s) you want enchants present in, the enchantments you want, and then restart your server for enchants to begin taking effect, such as appearing in enchantment tables and in the creative enchanted-book list.
⚠️ Enchants Require Restarts!
Vanilla Overrides
MythicEnchants defaults to offering vanilla overrides to allow you total customized management of vanilla's enchantments. These can be found in the /MythicMobs/packs/Vanilla_Enchants/ pack and modified there. Out-of-box they emulate vanilla's behaviors while exposing their values and configuration for you to modify.
First Custom Enchantment
Here's a step-by-step walkthrough towards creating your first custom enchantment, Silent Moons:
Step 1: Create the Enchantment File
Navigate to /plugins/MythicMobs/enchantments/ and create silent_moons.yml. This is where the enchantment will live, but it could be in any /MythicMobs/packs/<name>/enchantments/ folder thanks to Mythic Packs.
We'll start with its basic info in that file, and keep building there:
silent_moons:
Display: "<aqua>Silent Moons"
Description: "<gray>A blessing of the <green>Lunar Forge<gray>."
Vanilla does not support colors in item enchantment tooltips, so formatting codes will be stripped when shown on an item, but still be present in placeholders and other rich-text contexts. The item will simply show Silent Moons on items. The Description is used solely in placeholders and context menus.
Step 2: Enchantment Properties
Next, we'll define some of its core properties:
Rarity: RARE # An optional, configured rarity tier group
MaxLevel: 3 # The highest level the enchantment can be
AnvilCost: 2 # The EXP cost this contributes to anvil operations
SupportedItems: # The items this enchantment is permitted to be on, using a minecraft item tag and a material id
- '#minecraft:enchantable/melee_weapon'
PrimaryItems: # The items this enchantment is offered to in enchanting tables - supported items might require an anvil operation to move a valid enchant onto them
- '#minecraft:swords'
ConflictingEnchants: # Enchantments this cannot coexist with on an item
- minecraft:wind_burst
- '#minecraft:exclusive_set/damage' # makes this incompatible with the other damage-enchant set of sharpness, smite, etc.
Tags: # manage datapack tags to control vanilla behaviors
- '#minecraft:exclusive_set/damage' # makes the other damage-enchants incompatible with this enchant, since they share the same ConflictingEnchant tag in vanilla.
- mythicenchants:lunar # custom tag used for later configuration, such as adding it to a loot table pool of options.
These configure its rarity tier for appearance and enchantment table offers, its max level of 3 and its anvil operation costs.
We've also permitted it to be possible to put on several weapon types using an Item Tag, including the mace, but having enchanting tables only offer it onto swords thanks to that item tag. Using Enchantment Tags, we've made it incompatible with other damage enchantments like Sharpness, as well as exclusive with Wind Burst on maces, and given it a custom lunar tag a third-party datapack or loot table could use for our own group of lunar-themed enchantments.
Step 3: Enchantment Behavior
Next, we'll define its actual behavior, using a Mythic-based Skill:
Skills:
- skill{s=enchant_silent_moons} @target ~onAttack
- actionmessage{m="<blue>The Tide Calls..."} @self ~onSwing # this is a test line we'll remove later
We've added a test message to our action bar to see the enchantment take effect, and have set up the enchant_silent_moons metaskill to trigger when the wielder hits a target. Now let's build that metaskill, which we'll create in /plugins/MythicMobs/skills/silent_moons.yml (but could be in any Skills folder in any pack!)
enchant_silent_moons:
Conditions:
- itemRecharging false # it's a fully-powered swing, not a partial attack
- outside # the attacker is outside under the open sky
- night # at night
- lunarphase{phase=0} false # when it's not a full moon
- chance{c=<skill.var.enchant-level>*0.1} # Using Mythic Premium, we can use inline math to increase the chance of this activating by 5% x enchant level
Skills:
- particle{p=wax_off;amount=3;spread=1;audience=@server} @targetLocation{yo=1} # show some colorful sparks around the target to all players
- damage{d=<skill.var.enchant-level>} # deal damage equal to the enchantment level to the target
We now have a metaskill that checks a few conditions, such as if the player is outside under moonlight attacking, and if so they have a chance to deal some extra damage shown by particles! If you ask me, this enchantment isn't quite as cool as Smite, but I'm sure you can expand it and make it more fun to use!
Step 4: Implement and Test
Now that the enchantment files are complete, it's time to deploy it into the world and test it!
‼️Since we just created a brand new enchantment, the server must restart to register it into its datapack and deploy it into the world.
After the server has restarted, we can check out our new enchantment by grabbing a sword and trying to enchant it with /enchant @s mythicenchants:silent_moons (assuming your namespace in your config is still mythicenchants of course). It should also appear as a Silent Moons III enchanted book in your creative inventory if registered properly.
Give that weapon a few swings - it should be sending an action bar message about the Tide Calling if the enchantment is present and working.
Step 5: Cleanup
We mentioned earlier that once the enchantment is working, we'd remove the test message. We'll delete the following from the file:
- actionmessage{m="<blue>The Tide Calls..."} @self ~onSwing # a test line we'll remove later
Unlike creating a new enchantment, modifying an existing enchantment typically only requires /mythicmobs reload to apply behavior changes, since the enchantment is already registered in the datapack.
After /mm reload we should be able to use the enchantment without the message spam.
Next Steps
Now you've seen some of the core pieces come together to build an enchantment. Explore the complete options for Custom Enchantments, learn more about the Mythic Skill System, or check out some example packs to download and explore!