DynamicLights
手持物品会发出动态光源,并跟随玩家和生物实时移动。专为现代 Paper 1.21+ 构建。无需客户端模组、无需 ProtocolLib、无需修改世界数据。
你手中的火把会照亮周围的洞穴。僵尸头上的南瓜灯会让僵尸本身发光。将灯笼放在地上,它会照亮房间。当你走开后,世界再次变暗——你的存档文件从未改变。
为什么选择此插件
- 专为 Paper 1.21+ 构建 —— 大多数替代方案仍停留在 1.16。
- 生物发光 —— 给僵尸手中的火把或头顶的南瓜灯,它就会发着光四处走动。支持按生物类型配置。
- 柔和衰减簇 —— 外围光源块的亮度逐渐衰减,使运动看起来平滑而非跳跃。
- 零依赖 —— 纯 Paper API。无需 ProtocolLib,无需 PacketEvents。
- 单玩家开关 —— 客户端可以选择退出以节省性能。通过 PDC 持久化保存设置。
- 单世界禁用 —— 可以通过名称跳过下界、末地或任何特定世界。
- 热重载无需重启 ——
/dl reload 会恢复所有幻影方块、重新加载配置并继续运行。
- 体积小巧 —— ~40 KB jar 包,除 bStats 外无阴影依赖。
功能
| 功能 |
状态 |
| 玩家手持物品(主手、副手) |
✅ |
| 玩家可穿戴光源(头盔槽位) |
✅ |
| 生物手持物品(僵尸、骷髅、猪灵等) |
✅ |
| 生物可穿戴光源(僵尸头上的南瓜灯) |
✅ |
| 掉落物品发光(地上的灯笼发光) |
✅ |
| 可配置的物品 → 亮度映射 |
✅ |
| 用于平滑移动的簇衰减效果 |
✅ |
单玩家切换 (/dl toggle) |
✅ |
| 单世界禁用 |
✅ |
| 水下支持(水logged 光源块) |
✅ |
| 无世界修改 —— 纯基于数据包 |
✅ |
| 旁观者和隐身检测 |
✅ |
| 热重载 |
✅ |
| 可替换方块白名单(保留台阶、旗帜等) |
✅ |
兼容性
- 服务器: Paper 1.21.x(基于 1.21.4 API 构建;已在 1.21.11 上测试)。应在任何 1.21 补丁版本上运行。
- Java: 21+。
- Folia / Spigot: 未测试。欢迎提交 PR。
- 冲突: 目前已知无冲突。由于不修改世界数据,随时可以安全移除。
默认物品亮度
TORCH 14 LANTERN 15 GLOWSTONE 15 JACK_O_LANTERN 15
SOUL_TORCH 10 SOUL_LANTERN 10 REDSTONE_TORCH 7
SEA_LANTERN 15 SHROOMLIGHT 15 END_ROD 14
CAMPFIRE 14 SOUL_CAMPFIRE 10 GLOW_BERRIES 6 BLAZE_ROD 10
通过 config.yml 添加或覆盖任意材质。
命令
| 命令 |
权限 |
描述 |
/dynamiclights toggle |
dynamiclights.toggle |
切换您自己的动态光源。 |
/dynamiclights reload |
dynamiclights.reload |
重新加载配置 + 恢复运行。 |
/dynamiclights status |
— |
诊断信息:跟踪的光源发射器、配置摘要。 |
别名:/dl, /dynlights。
配置
enabled: true
view_radius: 32
update_interval_ticks: 1
mob_scan_interval_ticks: 4
track_mobs: true
track_items: true # 地上的掉落物品会发光
suppress_vanished_emitters: true
suppress_spectator_emitters: true
cluster_radius: 1 # 0 = 单列, 1 = 3x3, 2 = 5x5 (上限为 2)
cluster_height: 2 # 1 = 仅头部, 2 = 头部 + 身体 (上限为 3)
cluster_falloff_per_block: 2 # 从中心每增加一个方块距离减去的亮度值
disabled_worlds: [] # 例如 [world_nether, world_the_end]
mob_whitelist:
- ZOMBIE
- SKELETON
- PIGLIN
- DROWNED
equipment_slots:
- MAIN_HAND
- OFF_HAND
- HEAD
item_brightness:
TORCH: 14
LANTERN: 15
GLOWSTONE: 15
JACK_O_LANTERN: 15
replaceable_blocks: # 只有这些方块可以被替换为幻影光源
- AIR
- CAVE_AIR
- WATER
- SHORT_GRASS
- TALL_GRASS
工作原理
当实体持有配置好的光源物品时,插件会向附近的每个玩家发送一个幻影 minecraft:light[level=N,waterlogged=B] 方块更新数据包,位置在实体的眼睛位置(及周围簇区域)。实际世界数据从未被触碰——区块光照不会重新计算,也不会放置任何方块。当实体移动时,之前的方块会通过真实方块数据包进行还原,并发射新的方块。
由于原版 Minecraft 客户端仅了解基于方块级别的光照,动态光源本质上会吸附到方块网格上。簇和衰减设置可以使视觉过渡更柔和,但无法使光线完全连续——这需要像 LambDynamicLights 或 Optifine 的动态光源这样的客户端模组。
性能
在一个拥有约 30 只手持火把生物的 4 人测试服务器上,使用默认簇大小(3×2×3 = 每个发射器 18 个方块),每刻任务耗时 < 1 毫秒。如果您的服务器受 CPU 限制:
- 设置
track_mobs: false 以跳过每刻的生物扫描。
- 将
cluster_radius 降低至 0(单列而不是 3×3)。
- 增加
update_interval_ticks 至 2(光源以 10 Hz 频率跟随实体,而不是 20 Hz)。
安装
- 将
DynamicLights-x.y.z.jar 放入服务器的 plugins/ 文件夹中。
- 重启服务器。
- 根据需要编辑
plugins/DynamicLights/config.yml。
- 执行
/dl reload。
许可证
专有软件 —— 保留所有权利。您可以在自己的 Minecraft 服务器上安装和运行未经修改的插件副本。未经书面许可,禁止重新分发、修改和逆向工程。
DynamicLights
Held items emit dynamic light that follows players and mobs in real time. Built for modern Paper 1.21+. No client mod, no ProtocolLib, no world modification.
A torch in your hand lights up the cave around you. A jack-o-lantern on a zombie's head lights up the zombie. Drop a lantern on the floor and it lights up the room. Walk away and the world goes dark again — your save file never changes.
Why this plugin
- Built for Paper 1.21+ — most alternatives are stuck on 1.16.
- Mobs emit light — give a zombie a torch in its hand or a jack-o-lantern on its head and it walks around lit up. Configurable per mob type.
- Soft falloff clusters — outer light blocks fade in brightness so motion looks smooth instead of jumpy.
- Zero dependencies — pure Paper API. No ProtocolLib, no PacketEvents.
- Per-player toggle — clients can opt out for performance. Persisted via PDC.
- Per-world disable — skip Nether, End, or any world by name.
- Reload without restart —
/dl reload reverts all phantom blocks, reloads config, resumes.
- Tiny footprint — ~40 KB jar, no shaded dependencies except bStats.
Features
| Feature |
Status |
| Player held items (main hand, off hand) |
✅ |
| Player wearable lights (helmet slot) |
✅ |
| Mob held items (zombies, skeletons, piglins, etc.) |
✅ |
| Mob wearable lights (jack-o-lantern on a zombie's head) |
✅ |
| Dropped item lighting (lantern on the ground glows) |
✅ |
| Configurable item → brightness map |
✅ |
| Soft cluster falloff for smooth movement |
✅ |
Per-player toggle (/dl toggle) |
✅ |
| Per-world disable |
✅ |
| Underwater (waterlogged light blocks) |
✅ |
| No world modification — purely packet-based |
✅ |
| Spectator and vanish detection |
✅ |
| Hot reload |
✅ |
| Replaceable-block whitelist (preserves slabs, banners, etc.) |
✅ |
Compatibility
- Server: Paper 1.21.x (built against 1.21.4 API; tested on 1.21.11). Should run on any 1.21 patch.
- Java: 21+.
- Folia / Spigot: untested. PRs welcome.
- Conflicts: none known. Does not modify world data, so safe to remove at any time.
Default item brightness
TORCH 14 LANTERN 15 GLOWSTONE 15 JACK_O_LANTERN 15
SOUL_TORCH 10 SOUL_LANTERN 10 REDSTONE_TORCH 7
SEA_LANTERN 15 SHROOMLIGHT 15 END_ROD 14
CAMPFIRE 14 SOUL_CAMPFIRE 10 GLOW_BERRIES 6 BLAZE_ROD 10
Add or override any material via config.yml.
Commands
| Command |
Permission |
Description |
/dynamiclights toggle |
dynamiclights.toggle |
Toggle dynamic lights for yourself. |
/dynamiclights reload |
dynamiclights.reload |
Reload config + resume. |
/dynamiclights status |
— |
Diagnostics: tracked emitters, config summary. |
Aliases: /dl, /dynlights.
Configuration
enabled: true
view_radius: 32
update_interval_ticks: 1
mob_scan_interval_ticks: 4
track_mobs: true
track_items: true # dropped items on the ground emit light
suppress_vanished_emitters: true
suppress_spectator_emitters: true
cluster_radius: 1 # 0 = single column, 1 = 3x3, 2 = 5x5 (capped at 2)
cluster_height: 2 # 1 = head only, 2 = head + body (capped at 3)
cluster_falloff_per_block: 2 # subtract per block of distance from center
disabled_worlds: [] # e.g. [world_nether, world_the_end]
mob_whitelist:
- ZOMBIE
- SKELETON
- PIGLIN
- DROWNED
equipment_slots:
- MAIN_HAND
- OFF_HAND
- HEAD
item_brightness:
TORCH: 14
LANTERN: 15
GLOWSTONE: 15
JACK_O_LANTERN: 15
replaceable_blocks: # only these blocks may be replaced with phantom light
- AIR
- CAVE_AIR
- WATER
- SHORT_GRASS
- TALL_GRASS
How it works
When an entity holds a configured light item, the plugin sends each nearby player a phantom minecraft:light[level=N,waterlogged=B] block-update packet at the entity's eye position (and surrounding cluster). The actual world is never touched — chunk lighting isn't recomputed and no blocks are placed. When the entity moves, the previous block(s) are reverted with a real-block packet and new ones are emitted.
Because the vanilla Minecraft client only knows about block-level lighting, dynamic lights inherently snap to the block grid. The cluster + falloff settings make the visual transitions softer but cannot make the light fully continuous — that requires a client-side mod such as LambDynamicLights or Optifine's Dynamic Lights.
Performance
On a 4-player test server with ~30 mobs holding torches, default cluster size (3×2×3 = 18 blocks per emitter), the per-tick task takes < 1 ms. If your server is CPU-bound:
- Set
track_mobs: false to skip the per-tick mob scan.
- Lower
cluster_radius to 0 (single column instead of 3×3).
- Increase
update_interval_ticks to 2 (light follows entity at 10 Hz instead of 20 Hz).
Installation
- Drop
DynamicLights-x.y.z.jar into your server's plugins/ folder.
- Restart.
- Edit
plugins/DynamicLights/config.yml to taste.
/dl reload.
License
Proprietary — All Rights Reserved. You may install and run unmodified copies of the plugin on your own Minecraft servers. Redistribution, modification, and reverse engineering are not permitted without written permission.
评论 0
登录后参与评分
还没有评论,来抢沙发吧