**---
插件概览
| 属性 |
值 |
| 名称 |
PaperLuckyBlocks |
| 版本 |
1.0.0 |
| API |
Paper 1.21.1 - 1.21.8 |
| Java 版本 |
21 |
| 依赖项 |
无(独立运行) |
此插件功能
PaperLuckyBlocks 为 Paper 服务器完美还原了经典的 Lucky Block Mod 体验。玩家可以制作、放置并破坏幸运方块,触发从宝藏掉落至危险陷阱等各种随机结果。该插件还包含三个具有独特战斗能力的特殊幸运物品。
核心机制
┌─────────────────────────────────────────────────────────────┐
│ 幸运方块流程 │
├─────────────────────────────────────────────────────────────┤
│ 制作幸运方块 → 放置方块 → 破坏方块 │
│ ↓ ↓ ↓ │
│ 8金锭 + 发射器 存储运气 触发结果 │
│ 等级 基于运气 │
└─────────────────────────────────────────────────────────────┘
幸运方块系统
幸运方块物品
| 属性 |
描述 |
| 材质 |
玩家头颅(骷髅) |
| 纹理 |
自定义 Base64 黄色问号皮肤 |
| 可堆叠 |
是(64个) |
| 可合成 |
是 |
| 数据存储 |
PersistentDataContainer |
外观表现
┌─────────────────────────┐
│ ★ 幸运方块 ★ │ ← 金色粗体标题
│ │
│ 运气: +50 │ ← 颜色编码的运气值
│ [████████████░░░░░░] │ ← 视觉运气条
│ │
│ "感觉有点幸运..." │ ← 动态描述
│ │
│ 破坏以揭晓! │ ← 操作提示
└─────────────────────────┘
运气等级详解
| 范围 |
颜色 |
描述 |
结果倾向 |
| +75 至 +100 |
深绿色 |
命运极大地眷顾你! |
几乎总是正面结果 |
| +50 至 +74 |
绿色 |
几率站在你这边 |
大部分为正面结果 |
| +25 至 +49 |
黄色 |
感觉有点幸运... |
略微偏向正面 |
| 0 至 +24 |
白色 |
命运与机遇平衡 |
中性 |
| -25 至 -1 |
金色 |
小心前行... |
略微偏向负面 |
| -50 至 -26 |
红色 |
厄运即将来临 |
大部分为负面结果 |
| -100 至 -51 |
深红色 |
被糟糕的运气诅咒! |
几乎总是负面结果 |
合成配方
┌─────┬─────┬─────┐
│ │ │ │ = 金锭
├─────┼─────┼─────┤
│ │ │ │ = 发射器
├─────┼─────┼─────┤
│ │ │ │ 结果:幸运方块(运气: 0)
└─────┴─────┴─────┘
放置与破坏
放置时:
- 方块位置和运气等级存储在内存中
- 附魔粒子效果出现
- 播放铃声音效
- 方块变为带有自定义纹理的玩家头颅
破坏时:
- 取消正常掉落
- 播放破坏特效(金色粒子、升级音效)
- 显示结果名称的标题
- 延迟 0.5 秒后执行随机结果
- 运气等级影响结果选择
⚔️ 幸运物品
幸运之剑
| 属性 |
值 |
| 基础材质 |
金剑 |
| 攻击伤害 |
6.0(可通过属性配置调整) |
| 攻击速度 |
标准剑速 |
| 附魔 |
耐久 V(隐藏发光效果) |
| 触发条件 |
击中任何生物实体 |
幸运之剑效果
| 效果 |
概率 |
描述 |
| 箭雨 |
5% |
向受害者发射 5 支带有轻微散射的箭矢 |
| 吸血 |
5% |
攻击者恢复 3 颗心(6 半颗心) |
| 失明 |
5% |
对受害者施加失明 + 缓降效果 |
┌──────────────────────────────────────────────────────┐
│ ✦ 幸运之剑 ✦ │
├──────────────────────────────────────────────────────┤
│ 一把受命运祝福的剑刃! │
│ │
│ ⚔ 攻击伤害: 6 │
│ │
│ 随机效果(5% 概率): │
│ ➤ 箭雨 - 发射 5 支箭矢 │
│ ➤ 吸血 - 恢复 3 颗心 │
│ ➤ 失明 - 使敌人失明 │
└──────────────────────────────────────────────────────┘
箭雨机制
- 生成 5 支箭矢,每支之间间隔 2 tick
- 箭矢自动追踪受害者的中心质量点
- 每支箭矢造成 4.0 伤害
- 箭矢无法被拾取
- 箭矢发光以增强可见性
- 每支箭矢命中时产生暴击粒子
吸血机制
- 根据配置值治疗(默认:6 半颗心)
- 不能超过最大生命值
- 红色尘埃粒子从受害者流向攻击者
- 攻击者周围出现心形粒子
- 令人满意的音效
失明机制
- 对受害者施加 I 级失明持续 5 秒(100 tick)
- 对受害者施加 II 级缓慢持续 3 秒(60 tick)
- 受害者身上出现女巫和烟雾粒子
- 幻术师法术音效
幸运弓
| 属性 |
值 |
| 基础材质 |
弓 |
| 附魔 |
无限 I、耐久 V、力量 III |
| 触发条件 |
射出箭矢 |
幸运弓效果
| 效果 |
概率 |
描述 |
| 爆炸 |
10% |
箭矢变成点燃的 TNT |
| 熔岩 |
10% |
箭矢变成下落的岩浆块 |
| 陨石 |
10% |
箭矢变成大型火球 |
┌──────────────────────────────────────────────────────┐
│ ✦ Lucky Bow ✦ │
├──────────────────────────────────────────────────────┤
│ 一把充满混乱能量的弓! │
│ │
│ 随机效果(10% 概率): │
│ ➤ 爆炸 - 箭矢变为 TNT │
│ ➤ 熔岩 - 箭矢变为岩浆 │
│ ➤ 陨石 - 发射火球 │
│ │
│ ∞ 无限耐久 │
└──────────────────────────────────────────────────────┘
爆炸箭机制
- 原始箭矢被取消,改为生成 TNT
- TNT 继承箭矢 80% 的速度
- 3 秒引信(60 tick)
- 爆炸强度:3.0(若禁用破坏性则为 0)
- 火焰与烟雾粒子轨迹
- TNT 点燃音效
熔岩箭机制
- 下落岩浆块,速度为箭矢的 120%
- 每格造成 5.0 点伤害
- 使实体燃烧 3 秒
- 撞击时:
- 若启用破坏性:在 3x3 区域产生火焰
- 若禁用破坏性:仅视觉效果 + 火焰伤害
- 岩浆与火焰粒子轨迹
陨石机制
- 大型火球实体
- 速度为箭矢的 50%(较慢但更具戏剧性)
- 爆炸强度:2.0(若禁用破坏性则为 0)
- 基于破坏性设置的易燃特性
- 史诗级火焰/烟雾/岩浆粒子轨迹
- 恶魂射击 + 烈焰人射击 + 龙吼音效
幸运药水
| 属性 |
值 |
| 基础材料 |
喷溅药水 |
| 药水类型 |
幸运(仅视觉效果) |
| 附魔 |
无损 I(隐藏发光效果) |
| 触发条件 |
撞击时泼洒 |
┌──────────────────────────────────────────────────────┐
│ ✦ Lucky Potion ✦ │
├──────────────────────────────────────────────────────┤
│ 一瓶纯粹、浓缩的幸运药水! │
│ │
│ ⚗ 效果: │
│ 在撞击位置触发随机的幸运方块 │
│ 结果! │
│ │
│ 请谨慎投掷... │
└──────────────────────────────────────────────────────┘
幸运药水机制
- 完全取消正常药水效果
- 在泼洒位置触发 OutcomeManager
- 使用中立运气值(0)进行结果选择
- 撞击时产生扩散的女巫粒子环
- 图腾、末地烛和附魔粒子
- 可触发任何结果(包括建筑、生物等)
结果系统
结果分类
| 分类 |
数量 |
描述 |
| 物品 |
2 |
掉落珍贵物品 |
| 生物 |
2 |
生成生物 |
| 建筑 |
2 |
建造方块结构 |
| 爆炸 |
2 |
爆炸效果 |
| 特殊 |
1 |
独特机制 |
结果属性
每个结果都具备以下属性:
| 属性 |
类型 |
描述 |
name |
String |
唯一标识符 |
displayName |
String |
向玩家显示的名称 |
weight |
int |
选择概率权重 |
isPositive |
boolean |
对玩家有利? |
isDestructive |
boolean |
修改世界? |
luckModifier |
int |
运气影响范围(-100 至 +100) |
权重与运气公式
// 基础选择权重
adjustedWeight = baseWeight * (1 + (playerLuck * outcomeLuckModifier) / 10000)
// 示例:钻石结果(luckModifier: +60),玩家运气 +80
adjustedWeight = 50 * (1 + (80 * 60) / 10000)
adjustedWeight = 50 * 1.48 = 74
物品结果
钻石结果
| 属性 |
值 |
| 名称 |
diamonds |
| 权重 |
50 |
| 运气修正 |
+60 |
| 破坏性 |
否 |
功能说明:
- 生成 1-5 颗钻石(可配置)
- 每颗钻石具有向上的速度和扩散效果
- 钻石发光并拥有自定义名称 "★ Diamond ★"
- 环绕下落的尘埃粒子
- 每颗钻石拾取时的经验球音效
下界合金盔甲结果
| 属性 |
值 |
| 名称 |
netherite_armor |
| 权重 |
10(稀有) |
| 运气修正 |
+90 |
| 破坏性 |
否 |
功能说明:
- 生成一个不可见的盔甲架,穿戴全套下界合金装备
- 盔甲架旋转并浮动 3 秒
- 展示结束后,盔甲以一定速度掉落
- 每件装备拥有自定义名称和描述
- 所有装备均附魔保护 IV、无损 III、经验修补
盔甲附魔详情:
- 头盔:呼吸 III、水下速掘
- 胸甲:荆棘 III
- 护腿:(标准)
- 靴子:摔落保护 IV、深海探索者 III、灵魂疾行 III
生物结果
巨人鲍勃结果
| 属性 |
值 |
| 名称 |
giant_bob |
| 权重 |
30 |
| 运气修正 |
-40 |
| 破坏性 |
否 |
功能说明:
- 生成名为 "★ BOB THE GIANT ★" 的巨型僵尸
- 鲍勃拥有 100 点生命值(50 颗心)
- 鲍勃每次攻击造成 15 点伤害
- 鲍勃拥有抗火效果和发光效果
- 鲍勃执行特殊攻击:
- 重拳砸地(每 5 秒):范围伤害 + 击退
- 咆哮(每 10 秒):对附近玩家施加缓慢效果
鲍勃死亡后掉落:
- 5 颗钻石
- 10 个金块
- 32 瓶经验瓶
- “鲍勃之心”(下界之星奖杯)
- 胜利音效 + 图腾粒子
蜜蜂群结果
| 属性 |
值 |
| 名称 |
bee_swarm |
| 权重 |
40 |
| 运气修正 |
-20 |
| 破坏性 |
否 |
两种变体(70%/30% 概率):
愤怒蜂群(70%):
- 生成 10 只愤怒的蜜蜂
- 蜜蜂会锁定并追逐玩家
- 蜂后和精英守卫蜂拥有独立命名
- 蜜蜂追击持续 30 秒
友好蜂群(30%):
- 生成 10 只被动状态的蜜蜂
- 蜜蜂围绕玩家盘旋
- 每 10 秒给予玩家再生 II 效果
- 玩家获得 16 个蜂巢 + 8 瓶蜂蜜
- 蜜蜂在 60 秒后飞走
️ 建筑结果
陷阱牢笼结果
| 属性 |
值 |
| 名称 |
cage_trap |
| 权重 |
25 |
| 运气修正 |
-60 |
| 破坏性 |
是 |
功能说明:
- 在玩家周围构建 3x3x4 的铁栏杆笼子
- 逐层动画式建造
- 铁块地板,铁栏杆墙壁
- 天花板上有水源(存在溺水风险)
- 玩家获得挖掘疲劳 II 效果
- 30 秒后笼子消失,或者如果玩家逃脱也会消失
结构:
第 4 层: [水源方块]
第 3 层: ███ (铁栏杆天花板 + 水logged)
█ █
███
第 1-2 层:███ (铁栏杆墙壁)
█ █
███
第 0 层: ███ (铁块地板)
███
███
宝箱塔结果
| 属性 |
值 |
| 名称 |
chest_tower |
| 权重 |
35 |
| 幸运修正 |
+40 |
| 破坏性 |
否 |
功能说明:
- 建造 5 层高的塔(可配置)
- 每层都有金块平台 + 箱子
- 梯子连接各层
- 越高的箱子 = 更好的战利品
战利品层级:
| 层级 |
物品 |
最大堆叠数 |
| 普通 |
煤炭、生铁、小麦、面包、箭等。 |
16 |
| 稀有 |
铁锭、金锭、经验瓶等。 |
8 |
| 史诗 |
钻石、绿宝石、附魔金苹果、鞘翅等。 |
3 |
按高度的战利品概率:
- 底部箱子:主要是普通物品
- 顶部箱子:高几率获得稀有物品 + 保证有价值物品
爆炸结果
TNT 结果
| 属性 |
值 |
| 名称 |
tnt |
| 权重 |
20 |
| 幸运修正 |
-70 |
| 破坏性 |
是 |
四种随机模式:
| 模式 |
描述 |
| 单个 TNT |
一个带倒计时的强力 TNT |
| TNT 雨 |
5 个 TNT 从 15 格高处落下 |
| TNT 圆环 |
6 个 TNT 呈环形向内移动 |
| TNT 齐射 |
3 个 TNT 射向玩家 |
如果禁用破坏性:
爆炸结果
| 属性 |
值 |
| 名称 |
explosion |
| 权重 |
15 |
| 幸运修正 |
-80 |
| 破坏性 |
是 |
三种随机模式:
| 模式 |
描述 |
| 即时 |
短暂充能,立即爆炸 |
| 延迟 |
3 秒戏剧性 buildup(蓄力),伴随粒子效果 |
| 连锁 |
7 次小爆炸 + 1 次大型终结爆炸 |
特性:
- 可配置威力(默认:4.0)
- 冲击波环形粒子效果
- 上升的烟柱
- 即使非破坏性也有玩家击退效果
✨ 特殊结果
许愿井结果
| 属性 |
值 |
| 名称 |
wishing_well |
| 权重 |
25 |
| 幸运修正 |
+30 |
| 破坏性 |
否 |
功能说明:
- 建造装饰性许愿井结构
- 中心喷泉喷出金粒(共 20 个)
- 偶尔出现特殊物品(锭、宝石)
- 末尾额外赠送金锭
结构包括:
- 圆石墙环
- 橡木栅栏柱
- 橡木台阶屋顶
- 萤石顶部
- 链子 + 灯笼
- 中心有水
- 基座周围有装饰花朵
命令与权限
命令
| 命令 |
参数 |
描述 |
/luckyblock give |
[player] [luck] |
给予幸运方块 |
/luckyblock givesword |
[player] |
给予幸运之剑 |
/luckyblock givebow |
[player] |
给予幸运之弓 |
/luckyblock givepotion |
[player] |
给予幸运药水 |
/luckyblock reload |
- |
重新加载配置 |
别名: /lb, /luckyblockspin
权限
| 权限 |
默认值 |
描述 |
luckyblocks.admin |
OP |
所有管理命令 |
luckyblocks.craft |
true |
合成幸运方块 |
luckyblocks.break |
true |
破坏幸运方块 |
luckyblocks.use.sword |
true |
幸运之剑效果 |
luckyblocks.use.bow |
true |
幸运之弓效果 |
luckyblocks.use.potion |
true |
幸运药水效果 |
⚙️ 配置
config.yml 结构
settings:
destructive-outcomes: true 切换 TNT/爆炸/岩浆
max-luck: 100 最大幸运值
min-luck: -100 最小幸运值
default-luck: 0 合成的方块幸运值
particles-enabled: true 视觉效果
sounds-enabled: true 音频效果
lucky-sword:
arrow-stream-chance: 0.05 5% 几率
vampirism-chance: 0.05 5% 几率
blindness-chance: 0.05 5% 几率
vampirism-heal: 6 恢复的心数(半心)
arrow-count: 5 每次箭流的箭矢数量
lucky-bow:
explosive-chance: 0.10 10% 几率
molten-chance: 0.10 10% 几率
meteorite-chance: 0.10 10% 几率
outcomes:
treasure:
diamonds:
weight: 50
enabled: true
min-amount: 1
max-amount: 5
netherite-armor:
weight: 10
enabled: true
... 更多结果
关键配置选项
| 选项 |
效果 |
destructive-outcomes: false |
禁用 TNT、爆炸、岩浆放置 |
particles-enabled: false |
禁用所有粒子效果 |
sounds-enabled: false |
禁用所有音效 |
Outcome enabled: false |
从池中移除该结果 |
Outcome weight: 0 |
实质上禁用该结果 |
技术架构
数据流
┌─────────────┐ ┌──────────────────┐ ┌───────────────┐
│ Player │────▶│ BlockListener │────▶│OutcomeManager │
│ Breaks Block│ │ Validates Block │ │Selects Outcome│
└─────────────┘ └──────────────────┘ └───────┬───────┘
│
┌──────────────────┐ │
│ LuckyOutcome │◀────────────┘
│ .execute() │
└────────┬─────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌─────────┐
│ Spawns │ │ Builds │ │ Drops │
│ Mobs │ │Structure │ │ Items │
└─────────┘ └──────────┘ └─────────┘
PersistentDataContainer 键
| 键 |
类型 |
用途 |
lucky_block |
Boolean |
标识幸运方块 |
luck_level |
Integer |
存储幸运值 |
lucky_sword |
Boolean |
标识幸运剑 |
lucky_bow |
Boolean |
标识幸运弓 |
lucky_potion |
Boolean |
标识幸运药水 |
线程安全
- 所有方块修改均在主线程上运行
- 计划任务使用
BukkitRunnable
- 随机数值使用
ThreadLocalRandom
- 无修改世界状态的异步操作
按类详解
主要类
| 类 |
用途 |
PaperLuckyBlocks |
插件主类、命令、生命周期 |
LuckyBlockManager |
物品创建、配方、验证 |
OutcomeManager |
结果注册、加权选择 |
监听器类
| 类 |
处理的事件 |
BlockListener |
BlockPlaceEvent, BlockBreakEvent |
ItemListener |
EntityDamageByEntityEvent, EntityShootBowEvent, PotionSplashEvent |
结果类
| 类 |
类别 |
正面效果 |
破坏性效果 |
DiamondOutcome |
物品 |
✅ |
❌ |
NetheriteArmorOutcome |
物品 |
✅ |
❌ |
GiantBobOutcome |
生物 |
❌ |
❌ |
BeeSwarmOutcome |
生物 |
❌ |
❌ |
CageTrapOutcome |
结构 |
❌ |
✅ |
ChestTowerOutcome |
结构 |
✅ |
❌ |
TNTOutcome |
爆炸 |
❌ |
✅ |
ExplosionOutcome |
爆炸 |
❌ |
✅ |
WishingWellOutcome |
特殊 |
✅ |
❌ |
基础类
| 类 |
用途 |
LuckyOutcome |
定义结果契约的接口 |
AbstractOutcome |
带有工具方法的基础实现 |
**---
Plugin Overview
| Property |
Value |
| Name |
PaperLuckyBlocks |
| Version |
1.0.0 |
| API |
Paper 1.21.1 - 1.21.8 |
| Java Version |
21 |
| Dependencies |
None (standalone) |
What This Plugin Does
PaperLuckyBlocks faithfully recreates the classic Lucky Block Mod experience for Paper servers. Players can craft, place, and break Lucky Blocks to trigger random outcomes ranging from treasure drops to dangerous traps. The plugin also includes three special Lucky Items with unique combat abilities.
Core Mechanics
┌─────────────────────────────────────────────────────────────┐
│ LUCKY BLOCK FLOW │
├─────────────────────────────────────────────────────────────┤
│ Craft Lucky Block → Place Block → Break Block │
│ ↓ ↓ ↓ │
│ 8 Gold + Dropper Stores Luck Triggers Outcome │
│ Level Based on Luck │
└─────────────────────────────────────────────────────────────┘
Lucky Block System
The Lucky Block Item
| Property |
Description |
| Material |
Player Head (Skull) |
| Texture |
Custom Base64 yellow question mark skin |
| Stackable |
Yes (64) |
| Craftable |
Yes |
| Data Storage |
PersistentDataContainer |
Visual Appearance
┌─────────────────────────┐
│ ★ Lucky Block ★ │ ← Gold bold title
│ │
│ Luck: +50 │ ← Color-coded luck value
│ [████████████░░░░░░] │ ← Visual luck bar
│ │
│ "Feeling lucky..." │ ← Dynamic description
│ │
│ Break to reveal! │ ← Action hint
└─────────────────────────┘
Luck Levels Explained
| Range |
Color |
Description |
Outcome Tendency |
| +75 to +100 |
Dark Green |
Fortune favors you greatly! |
Almost always positive |
| +50 to +74 |
Green |
The odds are in your favor |
Mostly positive |
| +25 to +49 |
Yellow |
Feeling a bit lucky... |
Slightly positive |
| 0 to +24 |
White |
Balanced between fortune and fate |
Neutral |
| -25 to -1 |
Gold |
Tread carefully... |
Slightly negative |
| -50 to -26 |
Red |
Misfortune looms ahead |
Mostly negative |
| -100 to -51 |
Dark Red |
Cursed by terrible luck! |
Almost always negative |
Crafting Recipe
┌─────┬─────┬─────┐
│ │ │ │ = Gold Ingot
├─────┼─────┼─────┤
│ │ │ │ = Dropper
├─────┼─────┼─────┤
│ │ │ │ Result: Lucky Block (Luck: 0)
└─────┴─────┴─────┘
Placement & Breaking
When Placed:
- Block location and luck level are stored in memory
- Enchantment particles appear
- Chime sound plays
- Block becomes a player head with custom texture
When Broken:
- Normal drops are cancelled
- Break effects play (golden particles, level-up sound)
- Title appears showing outcome name
- Random outcome executes after 0.5 second delay
- Luck level influences outcome selection
⚔️ Lucky Items
Lucky Sword
| Property |
Value |
| Base Material |
Golden Sword |
| Attack Damage |
6.0 (configurable via attributes) |
| Attack Speed |
Standard sword speed |
| Enchantments |
Unbreaking V (hidden glow) |
| Trigger |
Hit any living entity |
Lucky Sword Effects
| Effect |
Chance |
Description |
| Arrow Stream |
5% |
Fires 5 arrows at the victim with slight spread |
| Vampirism |
5% |
Heals attacker for 3 hearts (6 half-hearts) |
| Blindness |
5% |
Applies Blindness + Slowness to victim |
┌──────────────────────────────────────────────────────┐
│ ✦ Lucky Sword ✦ │
├──────────────────────────────────────────────────────┤
│ A blade blessed by fortune itself! │
│ │
│ ⚔ Attack Damage: 6 │
│ │
│ Random Effects (5% chance): │
│ ➤ Arrow Stream - Fires 5 arrows │
│ ➤ Vampirism - Heal 3 hearts │
│ ➤ Blindness - Blind the enemy │
└──────────────────────────────────────────────────────┘
Arrow Stream Mechanics
- Spawns 5 arrows with 2-tick delay between each
- Arrows home toward victim's center mass
- Each arrow deals 4.0 damage
- Arrows cannot be picked up
- Arrows glow for visibility
- Critical hit particles on each arrow
Vampirism Mechanics
- Heals based on config value (default: 6 half-hearts)
- Cannot exceed max health
- Red dust particles flow from victim to attacker
- Heart particles around attacker
- Satisfying sound effect
Blindness Mechanics
- Blindness I for 5 seconds (100 ticks)
- Slowness II for 3 seconds (60 ticks)
- Witch and smoke particles on victim
- Illusioner spell sound
Lucky Bow
| Property |
Value |
| Base Material |
Bow |
| Enchantments |
Infinity I, Unbreaking V, Power III |
| Trigger |
Shoot an arrow |
Lucky Bow Effects
| Effect |
Chance |
Description |
| Explosive |
10% |
Arrow becomes primed TNT |
| Molten |
10% |
Arrow becomes falling magma block |
| Meteorite |
10% |
Arrow becomes large fireball |
┌──────────────────────────────────────────────────────┐
│ ✦ Lucky Bow ✦ │
├──────────────────────────────────────────────────────┤
│ A bow infused with chaotic energy! │
│ │
│ Random Effects (10% chance): │
│ ➤ Explosive - Arrow becomes TNT │
│ ➤ Molten - Arrow becomes lava │
│ ➤ Meteorite - Launches fireball │
│ │
│ ∞ Infinity │
└──────────────────────────────────────────────────────┘
Explosive Arrow Mechanics
- Original arrow cancelled, TNT spawned instead
- TNT inherits 80% of arrow velocity
- 3-second fuse (60 ticks)
- Yield: 3.0 (or 0 if destructive disabled)
- Flame and smoke particle trail
- TNT primed sound
Molten Arrow Mechanics
- Falling magma block with 120% arrow velocity
- Deals 5.0 damage per block
- Sets entities on fire for 3 seconds
- On impact:
- If destructive enabled: Creates fire in 3x3 area
- If destructive disabled: Visual only + fire damage
- Lava and flame particle trail
Meteorite Mechanics
- Large fireball entity
- 50% of arrow velocity (slower but dramatic)
- Yield: 2.0 (or 0 if destructive disabled)
- Incendiary based on destructive setting
- Epic flame/smoke/lava particle trail
- Ghast shoot + blaze shoot + dragon growl sounds
Lucky Potion
| Property |
Value |
| Base Material |
Splash Potion |
| Potion Type |
Luck (visual only) |
| Enchantments |
Unbreaking I (hidden glow) |
| Trigger |
Splash on impact |
┌──────────────────────────────────────────────────────┐
│ ✦ Lucky Potion ✦ │
├──────────────────────────────────────────────────────┤
│ A potion of pure, concentrated luck! │
│ │
│ ⚗ Effect: │
│ Triggers a random Lucky Block │
│ outcome at the impact location! │
│ │
│ Throw wisely... │
└──────────────────────────────────────────────────────┘
Lucky Potion Mechanics
- Normal potion effects completely cancelled
- Triggers OutcomeManager at splash location
- Uses neutral luck (0) for outcome selection
- Expanding witch particle ring on impact
- Totem, end rod, and enchant particles
- Can trigger ANY outcome (including structures, mobs, etc.)
Outcomes System
Outcome Categories
| Category |
Count |
Description |
| Items |
2 |
Drop valuable items |
| Mobs |
2 |
Spawn creatures |
| Structures |
2 |
Build block structures |
| Explosions |
2 |
Explosive effects |
| Special |
1 |
Unique mechanics |
Outcome Properties
Every outcome has these properties:
| Property |
Type |
Description |
name |
String |
Unique identifier |
displayName |
String |
Shown to players |
weight |
int |
Selection probability |
isPositive |
boolean |
Good for player? |
isDestructive |
boolean |
Modifies world? |
luckModifier |
int |
Luck influence (-100 to +100) |
Weight & Luck Formula
// Base selection weight
adjustedWeight = baseWeight * (1 + (playerLuck * outcomeLuckModifier) / 10000)
// Example: Diamond outcome (luckModifier: +60) with player luck +80
adjustedWeight = 50 * (1 + (80 * 60) / 10000)
adjustedWeight = 50 * 1.48 = 74
Item Outcomes
Diamond Outcome
| Property |
Value |
| Name |
diamonds |
| Weight |
50 |
| Luck Modifier |
+60 |
| Destructive |
No |
What it does:
- Spawns 1-5 diamonds (configurable)
- Each diamond has upward velocity with spread
- Diamonds glow and have custom name "★ Diamond ★"
- Ring of falling dust particles
- Experience orb pickup sound per diamond
Netherite Armor Outcome
| Property |
Value |
| Name |
netherite_armor |
| Weight |
10 (rare) |
| Luck Modifier |
+90 |
| Destructive |
No |
What it does:
- Spawns invisible armor stand with full netherite set
- Armor stand rotates and bobs for 3 seconds
- After display, armor drops with velocity
- Each piece has custom name and lore
- All pieces enchanted with Protection IV, Unbreaking III, Mending
Armor enchantments:
- Helmet: Respiration III, Aqua Affinity
- Chestplate: Thorns III
- Leggings: (standard)
- Boots: Feather Falling IV, Depth Strider III, Soul Speed III
Mob Outcomes
Giant Bob Outcome
| Property |
Value |
| Name |
giant_bob |
| Weight |
30 |
| Luck Modifier |
-40 |
| Destructive |
No |
What it does:
- Spawns Giant zombie named "★ BOB THE GIANT ★"
- Bob has 100 HP (50 hearts)
- Bob deals 15 damage per hit
- Bob has fire resistance and glows
- Bob performs special attacks:
- Ground Pound (every 5s): AoE damage + knockback
- Roar (every 10s): Slowness to nearby players
On Bob's Death:
- 5 diamonds
- 10 gold blocks
- 32 experience bottles
- "Bob's Heart" (Nether Star trophy)
- Victory sound + totem particles
Bee Swarm Outcome
| Property |
Value |
| Name |
bee_swarm |
| Weight |
40 |
| Luck Modifier |
-20 |
| Destructive |
No |
Two variants (70/30 chance):
Angry Swarm (70%):
- 10 bees spawn angry
- Bees target and chase player
- Queen Bee and Elite Guard Bees named
- Bees pursue for 30 seconds
Friendly Swarm (30%):
- 10 bees spawn passive
- Bees orbit player
- Grant Regeneration II every 10 seconds
- Player receives 16 honeycomb + 8 honey bottles
- Bees fly away after 60 seconds
️ Structure Outcomes
Cage Trap Outcome
| Property |
Value |
| Name |
cage_trap |
| Weight |
25 |
| Luck Modifier |
-60 |
| Destructive |
Yes |
What it does:
- Builds 3x3x4 iron bar cage around player
- Construction is animated layer by layer
- Iron block floor, iron bar walls
- Water source on ceiling (drowning hazard)
- Player gets Mining Fatigue II
- Cage disappears after 30 seconds or if player escapes
Structure:
Layer 4: [Water Source Blocks]
Layer 3: ███ (Iron Bars Ceiling + Waterlogged)
█ █
███
Layer 1-2:███ (Iron Bars Walls)
█ █
███
Layer 0: ███ (Iron Block Floor)
███
███
Chest Tower Outcome
| Property |
Value |
| Name |
chest_tower |
| Weight |
35 |
| Luck Modifier |
+40 |
| Destructive |
No |
What it does:
- Builds tower of 5 levels (configurable)
- Each level has gold block platform + chest
- Ladders connect levels
- Higher chests = better loot
Loot tiers:
| Tier |
Items |
Max Stack |
| Common |
Coal, Raw Iron, Wheat, Bread, Arrows, etc. |
16 |
| Uncommon |
Iron Ingot, Gold Ingot, Experience Bottles, etc. |
8 |
| Rare |
Diamond, Emerald, Enchanted Golden Apple, Elytra, etc. |
3 |
Loot probability by height:
- Bottom chest: Mostly common
- Top chest: High rare chance + guaranteed valuable
Explosion Outcomes
TNT Outcome
| Property |
Value |
| Name |
tnt |
| Weight |
20 |
| Luck Modifier |
-70 |
| Destructive |
Yes |
Four random patterns:
| Pattern |
Description |
| Single TNT |
One powerful TNT with countdown |
| TNT Rain |
5 TNT falling from 15 blocks up |
| TNT Circle |
6 TNT in ring moving inward |
| TNT Volley |
3 TNT shot toward player |
If destructive disabled:
- Visual explosion only
- Player knockback
- No block damage
Explosion Outcome
| Property |
Value |
| Name |
explosion |
| Weight |
15 |
| Luck Modifier |
-80 |
| Destructive |
Yes |
Three random patterns:
| Pattern |
Description |
| Instant |
Brief charge, immediate explosion |
| Delayed |
3-second dramatic buildup with particles |
| Chain |
7 small explosions + 1 big finale |
Features:
- Configurable power (default: 4.0)
- Shockwave ring particle effect
- Rising smoke column
- Player knockback even if non-destructive
✨ Special Outcomes
Wishing Well Outcome
| Property |
Value |
| Name |
wishing_well |
| Weight |
25 |
| Luck Modifier |
+30 |
| Destructive |
No |
What it does:
- Builds decorative wishing well structure
- Gold nuggets fountain from center (20 total)
- Occasional special items (ingots, gems)
- Bonus gold ingots at end
Structure includes:
- Cobblestone wall ring
- Oak fence posts
- Oak slab roof
- Glowstone top
- Chain + lantern
- Water in center
- Decorative flowers around base
Commands & Permissions
Commands
| Command |
Arguments |
Description |
/luckyblock give |
[player] [luck] |
Give Lucky Block |
/luckyblock givesword |
[player] |
Give Lucky Sword |
/luckyblock givebow |
[player] |
Give Lucky Bow |
/luckyblock givepotion |
[player] |
Give Lucky Potion |
/luckyblock reload |
- |
Reload configuration |
Aliases: /lb, /luckyblockspin
Permissions
| Permission |
Default |
Description |
luckyblocks.admin |
OP |
All admin commands |
luckyblocks.craft |
true |
Craft Lucky Blocks |
luckyblocks.break |
true |
Break Lucky Blocks |
luckyblocks.use.sword |
true |
Lucky Sword effects |
luckyblocks.use.bow |
true |
Lucky Bow effects |
luckyblocks.use.potion |
true |
Lucky Potion effects |
⚙️ Configuration
config.yml Structure
settings:
destructive-outcomes: true Toggle TNT/explosions/lava
max-luck: 100 Maximum luck value
min-luck: -100 Minimum luck value
default-luck: 0 Crafted block luck
particles-enabled: true Visual effects
sounds-enabled: true Audio effects
lucky-sword:
arrow-stream-chance: 0.05 5% chance
vampirism-chance: 0.05 5% chance
blindness-chance: 0.05 5% chance
vampirism-heal: 6 Half-hearts healed
arrow-count: 5 Arrows per stream
lucky-bow:
explosive-chance: 0.10 10% chance
molten-chance: 0.10 10% chance
meteorite-chance: 0.10 10% chance
outcomes:
treasure:
diamonds:
weight: 50
enabled: true
min-amount: 1
max-amount: 5
netherite-armor:
weight: 10
enabled: true
... more outcomes
Key Configuration Options
| Option |
Effect |
destructive-outcomes: false |
Disables TNT, explosions, lava placement |
particles-enabled: false |
Disables all particle effects |
sounds-enabled: false |
Disables all sound effects |
Outcome enabled: false |
Removes outcome from pool |
Outcome weight: 0 |
Effectively disables outcome |
️ Technical Architecture
Data Flow
┌─────────────┐ ┌──────────────────┐ ┌───────────────┐
│ Player │────▶│ BlockListener │────▶│OutcomeManager │
│ Breaks Block│ │ Validates Block │ │Selects Outcome│
└─────────────┘ └──────────────────┘ └───────┬───────┘
│
┌──────────────────┐ │
│ LuckyOutcome │◀────────────┘
│ .execute() │
└────────┬─────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌─────────┐
│ Spawns │ │ Builds │ │ Drops │
│ Mobs │ │Structure │ │ Items │
└─────────┘ └──────────┘ └─────────┘
PersistentDataContainer Keys
| Key |
Type |
Used For |
lucky_block |
Boolean |
Identify Lucky Blocks |
luck_level |
Integer |
Store luck value |
lucky_sword |
Boolean |
Identify Lucky Swords |
lucky_bow |
Boolean |
Identify Lucky Bows |
lucky_potion |
Boolean |
Identify Lucky Potions |
Thread Safety
- All block modifications run on main thread
- Scheduled tasks use
BukkitRunnable
- ThreadLocalRandom for random values
- No async operations that modify world state
Class-by-Class Breakdown
Main Classes
| Class |
Purpose |
PaperLuckyBlocks |
Plugin main, commands, lifecycle |
LuckyBlockManager |
Item creation, recipes, validation |
OutcomeManager |
Outcome registration, weighted selection |
Listener Classes
| Class |
Events Handled |
BlockListener |
BlockPlaceEvent, BlockBreakEvent |
ItemListener |
EntityDamageByEntityEvent, EntityShootBowEvent, PotionSplashEvent |
Outcome Classes
| Class |
Category |
Positive |
Destructive |
DiamondOutcome |
Items |
✅ |
❌ |
NetheriteArmorOutcome |
Items |
✅ |
❌ |
GiantBobOutcome |
Mobs |
❌ |
❌ |
BeeSwarmOutcome |
Mobs |
❌ |
❌ |
CageTrapOutcome |
Structures |
❌ |
✅ |
ChestTowerOutcome |
Structures |
✅ |
❌ |
TNTOutcome |
Explosions |
❌ |
✅ |
ExplosionOutcome |
Explosions |
❌ |
✅ |
WishingWellOutcome |
Special |
✅ |
❌ |
Base Classes
| Class |
Purpose |
LuckyOutcome |
Interface defining outcome contract |
AbstractOutcome |
Base implementation with utilities |
---**
评论 0
登录后参与评分
还没有评论,来抢沙发吧