Stellar Enchants
适用于 Paper 1.21.x 的自定义附魔插件
它添加了三种通过潜行激活的工具附魔,可通过附魔台(在 30 级附魔槽位概率最高)、村民交易以及 /stellarenchant 命令获得。
✨ 附魔
附魔 工具 效果
Vein Miner 镐 开采整个相连的矿石矿脉。每多挖掘一个方块会消耗一点工具耐久度。
Tree Capitator 斧 砍倒整棵树,并在原处自动种下一株对应的树苗。
Smelt Touch 镐 矿石直接掉落熔炼后的锭/结果(铁、金、铜、远古残骸……)。覆盖精准采集;与效率附魔兼容。
重要提示:所有这三种效果仅在玩家潜行时(按住 Shift)触发。正常挖矿不受影响,因此你不会意外炸毁矿脉或砍倒树木。每个附魔工具的描述栏都会提醒玩家:
“Shift and mine to …”。
Smelt Touch + Vein Miner 可以叠加在同一把镐上——潜行挖掘一块铁矿石会破坏整个矿脉,并将所有方块熔炼成铁锭。
附魔兼容性
Smelt Touch ✗ Silk Touch — 互斥。Smelt Touch 总是会熔炼矿石,因此无法通过命令、砧或附魔台将 Silk Touch 添加到具有 Smelt Touch 的工具上(反之亦然)。
Smelt Touch ✓ Fortune — 完全兼容。Fortune 会倍增铁、金和铜矿石的熔炼产出(因此带有 Fortune 的镐会掉落额外的锭),同时煤炭/钻石/绿宝石/红石/青金石/石英保持其原版 Fortune 掉落物。远古残骸被排除在外——Fortune 永远不会倍增下界合金碎片。
树重植
Tree Capitator 会在每一根主干柱的底部种植一株树苗。对于四种 2×2 大小的树(丛林、深色橡木、云杉、金合欢),它会恢复全部四株树苗,以便巨型变种能够重新生长,而不仅仅是其中一株。
? 命令
text
/stellarenchant <enchantment> [level]
别名:/se, /stellarenchants
权限:stellarenchantment.enchant(默认:OP)
将你主手所持物品附上所选附魔。
<enchantment> 可以是以下之一:veinminer, treecapitator, smelttouch
(提供 Tab 补全)。
示例:
/stellarenchant veinminer
/se treecapitator
/se smelttouch
该命令会验证工具类型——例如 Tree Capitator 只能用于斧头,Vein Miner / Smelt Touch 只能用于镐。
? 在生存模式中获取附魔
附魔台 — 符合条件的镐/斧和书可以随机获得 Stellar 附魔。概率取决于所选附魔槽位,且在 30 级附魔时达到最高,正如所要求的那样。书可以随机获得任意一种附魔。
附魔书 — 书带有完整的描述栏文本 + 闪烁效果。可以通过对手持的书使用命令生成,从附魔台随机抽取,或者购买已经附魔的工具来获得。
村民交易 — 工具匠村民可能会出售预先附魔的镐(Vein Miner / Smelt Touch),武器匠村民可能会出售斧头(Tree Capitator),可用绿宝石购买。
命令 — 见上文(管理员/创造模式)。适用于工具和书。
? 砧与砂轮
砧 — 像原版一样组合 Stellar 附魔:
书 → 工具:将 Stellar 书的附魔应用到匹配的工具上。
工具 → 工具(同类型):合并,保留每个共享附魔的最高等级。
书 → 书:合并两本附魔书。
收取类似原版的经验等级费用(根据转移的内容缩放);无法负担费用的生存玩家无法取走结果。
附魔只会出现在正确的物品上(例如 Vein Miner 不会应用到斧头上)。
砂轮 — 从物品中移除所有 Stellar 附魔,就像它移除原版附魔一样。解除附魔的书会变回普通书。
? 工作原理(技术细节)
附魔存储在各自物品的 PersistentDataContainer (PDC) 中,作为以 stellarenchants:enchant_<id> 为键的整数。这完全版本稳定,且永远不会与原版附魔注册表冲突(后者在 1.20.5+ 版本发生了重大变化)。
每当添加或移除附魔时,可见的描述栏文本会从 PDC 重新构建。插件通过 PDC 计数器 (stellarenchants:lore_lines) 跟踪它拥有的前导描述栏行数,并在刷新时精确剥离这些行——因此它绝不会干扰其他插件的描述栏,也绝不会在文本中写入奇怪的标记字符(这修复了某些客户端渲染不支持字符图标的问题)。
附魔物品通过 setEnchantmentGlintOverride 获得附魔闪光效果。
连锁方块破坏作为真实的 BlockBreakEvents 触发(因此 WorldGuard 等领地/保护插件仍然适用),并带有防止无限递归的重入保护。每次激活硬限制为 256 个方块,以确保性能安全。
工具耐久度尊重原版的耐久度附魔。
Stellar Enchants
A custom enchantment plugin for Paper 1.21.x
It adds three shift-activated tool enchantments that obtain via the
enchanting table (best odds at the 30-level slot), villager trades,
and the /stellarenchant command.
✨ Enchantments
Enchantment Tool Effect
Vein Miner Pickaxe Mines an entire connected ore vein. Each extra block consumes one point of tool durability.
Tree Capitator Axe Chops down a whole tree and automatically replants a matching sapling where it stood.
Smelt Touch Pickaxe Ores drop their smelted ingot/result instantly (iron, gold, copper, ancient debris, …). Overrides Silk Touch; compatible with Fortune.
Important: all three effects only trigger while the player is sneaking
(holding Shift). Normal mining is never affected, so you won't accidentally
blow up a vein or fell a tree. Each enchanted tool's lore reminds the player:
"Shift and mine to …".
Smelt Touch + Vein Miner stack on the same pickaxe — shift-mining one iron ore
breaks the whole vein and smelts every block into iron ingots.
Enchantment compatibility
Smelt Touch ✗ Silk Touch — mutually exclusive. Smelt Touch always smelts
the ore, so Silk Touch can't be added to a Smelt Touch tool (and vice-versa)
via command, anvil, or the enchanting table.
Smelt Touch ✓ Fortune — fully compatible. Fortune multiplies the smelted
output for iron, gold and copper ores (so a Fortune pickaxe yields extra
ingots), plus coal/diamond/emerald/redstone/lapis/quartz which keep their
normal vanilla Fortune drops. Ancient Debris is excluded — Fortune never
multiplies netherite scrap.
Tree replanting
Tree Capitator replants a sapling on every base trunk column. For the four
2×2 trees (jungle, dark oak, spruce, acacia) it restores all four
saplings so the giant variant can regrow, instead of just one.
? Command
text
/stellarenchant <enchantment> [level]
Aliases: /se, /stellarenchants
Permission: stellarenchantment.enchant (default: OP)
Applies the chosen enchantment to the item held in your main hand.
<enchantment> is one of: veinminer, treecapitator, smelttouch
(tab-completion is provided).
Examples:
/stellarenchant veinminer
/se treecapitator
/se smelttouch
The command validates the tool type — e.g. Tree Capitator can only go on an
axe, Vein Miner / Smelt Touch only on a pickaxe.
? Obtaining enchantments in survival
Enchanting Table — eligible pickaxes/axes and books can roll a
Stellar enchantment. The chance scales with the chosen slot and is highest at
the 30-level enchant, exactly as requested. Books can roll any of the
three enchants.
Enchanted Books — books carry Stellar enchants with full lore + glint.
Create one with the command on a held book, roll one from the enchant table,
or trade for tools that already have the enchant.
Villager Trades — Toolsmith villagers may sell pre-enchanted pickaxes
(Vein Miner / Smelt Touch) and Weaponsmith villagers may sell axes
(Tree Capitator), purchasable for emeralds.
Command — see above (admins / creative). Works on tools and books.
? Anvil & Grindstone
Anvil — combine Stellar enchants like vanilla:
Book → Tool: apply a Stellar book's enchant to a matching tool.
Tool → Tool (same type): merges, keeping the higher level of each
shared enchant.
Book → Book: merges two enchanted books.
A vanilla-style XP level cost is charged (scales with what transfers);
survival players who can't afford it can't take the result.
Enchants only land where they belong (e.g. Vein Miner won't apply to an axe).
Grindstone — strips all Stellar enchants from an item, just like it
removes vanilla enchants. A disenchanted book reverts to a plain book.
? How it works (technical)
Enchantments are stored in each item's PersistentDataContainer (PDC) as
integers keyed under stellarenchants:enchant_<id>. This is fully version
stable and never collides with vanilla enchantment registries (which changed
heavily in 1.20.5+).
The visible lore is rebuilt from the PDC whenever an enchantment is added
or removed. The plugin tracks how many leading lore lines it owns via a PDC
counter (stellarenchants:lore_lines) and strips exactly those on refresh —
so it never disturbs other plugins' lore and never writes a stray marker
glyph into the text (this fixes the unsupported-character icon some clients
rendered).
Enchanted items receive the enchanted glint via
setEnchantmentGlintOverride.
Cascading block breaks are fired as real BlockBreakEvents (so land-claim /
protection plugins like WorldGuard still apply), with a re-entrancy guard to
prevent infinite recursion. A hard cap of 256 blocks per activation keeps
performance safe.
Tool durability respects the vanilla Unbreaking enchantment.
评论 0
登录后参与评分
还没有评论,来抢沙发吧