Denizen 脚本语言 - Paper 实现(非官方版本!)
这是适用于 Paper 服务器的 Denizen 脚本语言的一个实现,通过强大的 Citizens 集成来强调将 Denizen 与 NPC 结合使用的强大功能!
版本 1.3.4M:兼容 Paper 1.21.1、26.1.2、26.2 和 26.3!
-
事件:
- 新增对 Paper 专属事件
on player unchecked sign edits 的支持。
- 将
on player equips|unequips ... 迁移至更通用的 on <entity> equips|unequips <item> or armor|helmet|chestplate|leggings|boots|body 语法,扩展了对所有实体的支持并新增了身体槽位。
<context.entity> – 涉及的 EntityTag。
<context.slot> – 装备槽位的名称。
<context.new_item> / <context.old_item> – 槽位中当前和之前的 ItemTag。
-
资源包: 全面重构了 resourcepack 命令的逻辑以支持添加多个资源包。
- 为
resourcepack 命令添加了新的 add 参数,用于向玩家发送额外的资源包。
- 添加了
PlayerTag.remove_resource_pack 机制,可通过 ID 从玩家处移除特定的资源包。
- 添加了
PlayerTag.remove_resource_packs 机制,可从玩家处移除所有资源包。
-
文本与格式化:
- 新增标签:
<&sprite>、<&shadow_color>、<&shadow_gradient>、<&dual_gradient> 和 <&head>。
- Sprite 用法示例:
<&sprite[minecraft:items/item/porkchop]>
- 阴影颜色用法示例:
- 简单变体 -
<&shadow_color[#51a2ff]>
- 带可调透明度 -
<&shadow_color[<color[#51a2ff].with_alpha[254]>]>
- 阴影渐变用法示例:
- 简单变体 -
<&shadow_gradient[from=#51a2ff;to=#FFF085]>
- 带可调透明度 -
<&shadow_gradient[from=<color[#51a2ff].with_alpha[0]>;to=<color[#FFF085].with_alpha[254]>]>
- 双渐变包括阴影颜色和简单颜色渐变,用法示例:
- 简单变体 -
<&dual_gradient[from=#51a2ff;to=#FFF085;s_from=#FFF085;s_to=#51a2ff]>
- 用于调整简单颜色渐变的
from 和 to 标签。
- 用于调整阴影颜色渐变的
s_from 和 s_to 标签。
- Head 用法示例:
- 完整面部纹理 -
<&head[Tjtoxshpilivili1]>
- 仅面部纹理(无表面像素)-
<&head[!Tjtoxshpilivili1]>
- 为
ElementTag 添加了 .shadow_color、.shadow_gradient 和 .dual_gradient 标签。
-
内部迁移: 完全迁移到 Paper Components 以提升性能和现代 API 兼容性。
-
传送:
- 新增了一个
async 选项,可将玩家传送到未加载的区块而不会导致服务器卡顿;有时执行会有轻微延迟。详情:
- 新增了对使用 async 参数的传送的
~waitable 标签支持。这允许脚本精确跟踪并等待异步传送过程完全完成。
- 用法示例:
- 异步传送 -
teleport <player> <player.location.random_offset[99999,0,99999]> async
- 可等待的异步传送 -
~teleport <player> <player.location.random_offset[99999,0,99999]> async
-
播放特效:
- 迁移到 Paper 的现代
ParticleBuilder API,修复了粒子在距离玩家超过 32 格时无法渲染的原版限制。
- 新增了对
forced 参数的自动处理。以前,即使你为距离玩家 50 格生成的粒子指定了高可见半径(例如 visibility:100),它也不会显示。强制粒子现在确保它能正确地在延长距离上渲染。
- 用法示例 -
playeffect effect:END_ROD quantity:100 <player.location.random_offset[50,0,50]> visibility:100 forced
-
属性:
- 为物品新增了
.rarity_color 标签,返回 ColorTag。
- 用法示例 -
<player.item_in_hand.rarity_color>
-
自定义模型数据:
- 更新了
custom_model_data 机制和属性,返回包含 floats、strings、flags(布尔值)和 colors 的 MapTag。
- 现在接受包含
floats、strings、flags(布尔值)和 colors(RGB)列表的 MapTag,以实现高级物品模型选择,同时完全保留对单数字输入的向后兼容性。
- 用法示例:
- 向后兼容 -
inventory adjust slot:hand custom_model_data:1000
- 新格式 -
inventory adjust slot:hand custom_model_data:<map[floats=<list[1000]>;flags=<list[...]>;strings=<list[foo:bar]>;colors=<list[<color[127,0,0]>]>]>
- 简单用法 -
custom_model_data:[floats=1000;flags=...;strings=foo:bar;colors=<color[127,0,0]>]
-
核心优化: 在几个内部类中实现了自定义优化。
-
标签修改:
- 为标签
.find_entities[<#.#>].within[<#.#>] 新增了子标签 .unsorted,以绕过基于距离的排序。当不需要列表中实体的顺序时,使用此标签可获得更好的性能。
- 通过将
Math.pow 替换为直接乘法来优化 .distance 标签。这减少了计算开销,并在整个脚本中实现了更快的距离计算。
-
移除项:
- 已从所有对象中移除
.scriptname 标签。
- 已完全移除
Denizen ASAP Strong warning。
-
showfake: 修复了一个问题,即尽管命令能正常工作,但仍会触发错误消息。
-
fakeinternaldata: 修复了一个严重漏洞,即该命令无法工作并抛出错误。
The Denizen Scripting Language - Paper Impl (Unofficial version!)
An implementation of the Denizen Scripting Language for Paper servers, with strong Citizens interlinks to emphasize the power of using Denizen with NPCs!
Version 1.3.4M: Compatible with Paper 1.21.11, 26.1.2, 26.2 and 26.3!
-
Events:
- Added support for the Paper-specific event
on player unchecked sign edits.
- Migrated
on player equips|unequips ... to a generalized on <entity> equips|unequips <item> or armor|helmet|chestplate|leggings|boots|body syntax, extending support to all entities and adding the new body slot.
<context.entity> – The EntityTag involved.
<context.slot> – The name of the equipment slot.
<context.new_item> / <context.old_item> – The current and previous ItemTag in the slot.
-
Resource Pack: Fully overhauled the logic for the resourcepack command to support adding multiple resource packs.
- Added a new
add argument to the resourcepack command to send additional resource packs to a player.
- Added
PlayerTag.remove_resource_pack mechanism to remove a specific resource pack by ID from a player.
- Added
PlayerTag.remove_resource_packs mechanism to remove all resource packs from a player.
-
Text & Formatting:
- New tags:
<&sprite>, <&shadow_color>, <&shadow_gradient>, <&dual_gradient> and <&head>.
- Sprite usage example:
<&sprite[minecraft:items:item/porkchop]>
- Shadow Color usage examples:
- Simple variant -
<&shadow_color[#51a2ff]>
- With adjustable transparency -
<&shadow_color[<color[#51a2ff].with_alpha[254]>]>
- Shadow gradient usage examples:
- Simple variant -
<&shadow_gradient[from=#51a2ff;to=#FFF085]>
- With adjustable transparency -
<&shadow_gradient[from=<color[#51a2ff].with_alpha[0]>;to=<color[#FFF085].with_alpha[254]>]>
- Dual gradient including Shadow color and Simple color gradients, usage examples:
- Simple variant -
<&dual_gradient[from=#51a2ff;to=#FFF085;s_from=#FFF085;s_to=#51a2ff]>
- Tags
from and to for simple color gradient adjusting.
- Tags
s_from and s_to for shadow color gradient adjusting.
- Head usage examples:
- Full Face Texture -
<&head[Tjtoxshpilivili1]>
- Only Face Texture (without surface pixels) -
<&head[!Tjtoxshpilivili1]>
- Added
.shadow_color, .shadow_gradient and .dual_gradient tags to ElementTag.
-
Internal Migration: Fully migrated to Paper Components for improved performance and modern API compatibility.
-
Teleport:
- An
async option has been added that teleports the player to unloaded chunks without causing server lag; sometimes there is a slight delay in execution. Details:
- Added
~waitable tag support for teleports utilizing the async parameter. This allows scripts to precisely track and wait until the asynchronous teleportation process is fully completed.
- Usage examples:
- Async teleport -
teleport <player> <player.location.random_offset[99999,0,99999]> async
- Waitable async teleport -
~teleport <player> <player.location.random_offset[99999,0,99999]> async
-
Playeffect:
- Migrated to Paper's modern
ParticleBuilder API, fixing a vanilla limitation where particles wouldn't render beyond 32 blocks from the player.
- Added automatic handling for the
forced parameter. Previously, even if you specified a high visibility radius (e.g., visibility:100) for a particle spawned 50 blocks away, it wouldn't display. Forcing the particle now ensures it correctly renders at extended distances.
- Usage example -
playeffect effect:END_ROD quantity:100 <player.location.random_offset[50,0,50]> visibility:100 forced
-
Attributes:
- Added new
.rarity_color tag for items, returns ColorTag.
- Usage example -
<player.item_in_hand.rarity_color>
-
Custom Model Data:
- Updated
custom_model_data mechanism and property, returns a MapTag of floats, strings, flags (booleans), and colors.
- Now accepts a
MapTag containing Lists of floats, strings, flags (booleans), and colors (RGB) for advanced item model selection, while fully retaining backward compatibility for single-number inputs.
- Usage examples:
- Backward compatibility -
inventory adjust slot:hand custom_model_data:1000
- New format -
inventory adjust slot:hand custom_model_data:<map[floats=<list[1000]>;flags=<list[...]>;strings=<list[foo:bar]>;colors=<list[<color[127,0,0]>]>]>
- Simple usage -
custom_model_data:[floats=1000;flags=...;strings=foo:bar;colors=<color[127,0,0]>]
-
Core Optimization: Implementation of custom optimizations across several internal classes.
-
Tags Modification:
- Added new sub-tag
.unsorted to tag .find_entities[<#.#>].within[<#.#>] to bypass distance-based sorting. Use this for better performance when the order of entities in the list is not required.
- Optimized the
.distance tag by replacing Math.pow with direct multiplication. This reduces computational overhead and results in faster distance calculations across the script.
-
Removals:
- The
.scriptname tag has been removed from all objects.
Denizen ASAP Strong warning has been fully removed.
-
showfake: Fixed an issue where the command would trigger an error message despite functioning correctly.
-
fakeinternaldata: Fixed a critical bug where the command was non-functional and threw an error.
评论 0
登录后参与评分
还没有评论,来抢沙发吧