COWMODSКаталог модов

Better Enchant Commands

Better enchant commands to enhance your creative gameplay when utilizing /enchants and /give.

Автор: aGamingGod12341,4 тыс.1обновлён 16 апр. 2026 г.
СнаряжениеМеханики игрыОптимизация

Описание

Better Enchant Commands

Override /enchant, /give, and friends with extended enchantment levels, simplified syntax, presets, and an audited confirmation/undo workflow for Minecraft 1.21.x.

Vanilla /enchant refuses non-integer levels and caps out where the enchantment says so. Vanilla /give needs verbose component syntax for enchanted items. Better Enchant Commands replaces the two core commands and adds a handful of workflow helpers, all gated behind op level 2 and backed by a structured audit log.

Features

/enchant — enchant beyond vanilla limits

Drop-in replacement for vanilla /enchant. Apply any enchantment to the item in a player's hand at levels 1–255.

  • /enchant @s minecraft:sharpness 255
  • /enchant aGamingGod minecraft:protection 10
  • /enchant list

/enchant list prints the enchantments on the held item of the player running the command.

/give — inline enchantment syntax

Drop-in replacement for vanilla /give. Works exactly like normal when used without enchantments. Append an optional enchantments: block for instant enchanted items:

  • /give @s minecraft:netherite_chestplate enchantments:protection:10,unbreaking:3
  • /give @s minecraft:diamond_sword 1 enchantments:sharpness:255,fire_aspect:5,looting:10

The minecraft: namespace is optional — sharpness:255 works. No JSON, no brackets, no quotes. Tab completion filters candidates to enchantments actually compatible with the chosen item.

/enchantpreset — save and replay enchantment bundles

  • /enchantpreset save <name> — save currently-held item's enchantments
  • /enchantpreset apply <name> <targets>
  • /enchantpreset delete <name>
  • /enchantpreset list

Names are validated (1–64 chars, A–Z, a–z, 0–9, _, -). Skipped empty-hand targets are reported in the output.

/unenchant, /enchantinfo, /enchantlist

Cleanup and inspection helpers:

  • /unenchant <targets> — strip all enchantments
  • /unenchant <targets> <enchantment> — strip one
  • /enchantinfo — full detail on held item
  • /enchantlist [filter] — registry listing, optionally filtered

/repair — mended gear in one command

Hands out a copy of any item with Mending (and Unbreaking III where compatible) pre-applied. The reflective compat lookup is cached per session so repeat invocations are fast.

/enchants — bulk operations, undo, and config

  • /enchants undo — restore your last bulk modification
  • /enchants confirm <token> — complete a gated bulk operation
  • /enchants status
  • /enchants allow_all_enchantments true|false

Operations over confirmation_threshold targets require a short-lived token — no more accidental "enchanted the entire server" incidents. Undo is a bounded per-operator deque (default 8 entries).

Design highlights

  • Fail-safe validation. Enchantment strings parse into fully-validated (Identifier, level) pairs before any item is touched. Parse failures leave items unmodified.
  • Structured audit log. Every privileged action is emitted to a dedicated SLF4J [AUDIT] logger with sanitised operator, target, and label fields — safe to route to a log-aggregation pipeline.
  • Log-injection hardened. Any string originating from player input is stripped of ASCII control characters before being formatted into log lines, so a crafted scoreboard name can't forge or break audit entries.
  • Bounded bulk modifications. Commands that affect more targets than confirmation_threshold require a token-based confirmation round-trip.
  • Reflective compatibility layer. Permission checks, registry lookups, and component reads resolve via method-shape heuristics cached per class, so the same jar runs across all 1.21.x minor versions without recompilation.
  • Zero mixins. Pure Fabric API command registration — maximum compatibility with other mods.
  • Server-side only. Clients don't need the mod installed.

Why Better Enchant Commands?

  • Drop-in replacements. Overrides vanilla /enchant and /give directly; no new commands to memorise for the core workflow.
  • Fully backward compatible. /give @s diamond 64 still works exactly like vanilla.
  • Lightweight. ~105 KB, server-side only, no tick hooks, no mixins.
  • Crash-proof. Every code path is defensively wrapped; malformed input gives helpful error messages, never a server crash.
  • Cross-version. Built against 1.21 base — works on every 1.21.x subversion without recompilation.
  • Preset-driven workflow. Save standard loadouts once; apply them to any number of players with one command.
  • Audit trail. Operators can be held accountable for what they enchanted, for whom, and when.

Requirements

  • Minecraft 1.21.x (any subversion)
  • Fabric Loader 0.16.0+
  • Fabric API

Permissions

All commands require operator level 2, matching vanilla /enchant and /give.

Technical notes

Better Enchant Commands writes directly to the DataComponents.ENCHANTMENTS component on item stacks, bypassing vanilla's level validation but enforcing its own bounds (1–255). Enchantments are stored exactly like vanilla ones — no custom data, no compatibility issues with other mods reading your items.

Последние версии

Все версии →
release

Better Enchant Commands 1.1.0

1.1.0
16 апр. 2026 г.1,3 тыс.Minecraft: 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
Скачать
Что нового
## Better Enchant Commands 1.1.0 A hardening + polish release. Every existing command still works the same way for valid input — this release is about making bad input safer and bulk operations more transparent. ### Security - **Preset-name validation.** `/enchantpreset save <name>` and `/enchantpreset delete <name>` now require **1–64 characters** of `A–Z`, `a–z`, `0–9`, `_`, or `-`. Previously any non-whitespace token was accepted, which made unbounded disk growth and log-injection via crafted names possible. - **Preset-level clamping on disk load.** Preset entries read from the config file are now validated against `MIN_LEVEL..MAX_LEVEL` (1..255). A hand-edited or corrupted config can no longer push an out-of-range level into item NBT. - **Log-injection hardening.** `AuditLogger` strips ASCII control characters (newlines, tabs, ANSI escapes) from operator names, target names, labels, and config values before they reach SLF4J `{}` placeholders. Crafted scoreboard names can no longer forge or break lines in the audit log. ### Correctness - **Modded enchantment IDs with colons.** `EnchantmentParser` now splits on the **last** `:` in a token, so IDs like `mymod:some:path:10` parse correctly as namespace + path + level instead of being rejected with a confusing "too many parts" error. - **`/enchantpreset apply` empty-hand reporting.** Previously, players in the selector with an empty main hand were silently skipped. They're now listed in the failure output, matching the pattern already used by `/enchant` and `/unenchant`. - **Build fix.** A pre-existing compile error (`IllegalArgumentException | CommandSyntaxException | RuntimeException` multi-catch, which is invalid because `IllegalArgumentException` extends `RuntimeException`) is resolved, and two `createItemStack` call sites that newly throw `CommandSyntaxException` are properly handled. ### Performance - **Cached `/repair` lookups.** The reflective `mending` and `unbreaking` holder lookups in `/repair` are cached per enchantment registry, so they only run once per server session instead of on every command invocation. ### Added - `ConfirmationManager.storeWithReplacement` — an API variant callers can use to notify the operator when a prior pending confirmation is displaced. Not wired into any user-facing command yet, but available for downstream callers. ### Unchanged - Command surface, permission gates (op level 2), tab-completion behaviour, undo semantics, and preset JSON format are identical to 1.0.0. - Compiled against 1.21 base, still compatible across **all 1.21.x versions**.
beta

Better Enchant Commands 1.0.0

1.0.0
9 мар. 2026 г.145Minecraft: 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
Скачать