关于对各个 Minecraft 版本的支持
最近发生了许多变化,使得仅用一个模组 JAR 文件来支持多个版本变得困难。因此,如果您需要某个特定版本的支持,请在 GitHub 上提交一个 Issue,我将创建一个支持您所需版本的分支。否则,我将仅官方支持最新的 Minecraft 版本。
简介
Andrew's Datapack Utils 是一款面向 Fabric/NeoForge/Forge/Paper 的模组,旨在为数据包(主要是数据包函数)创建实用的工具。它添加了一个包含大多数实用功能的命令,并允许使用 /data 和 /execute store 修改玩家数据,从而轻松操作玩家实体,实现以前无法完成的功能。
功能
- 基础数学计算
- 通过执行
/aputils calc <add|sub|mul|div|power|sqrt|...>命令使用。与/execute store result和函数宏配合效果极佳。
- 通过执行
- 距离计算
/aputils calc distance <pos 1> <pos 2>或/aputils calc distance entities <selector1> <selector2>- 可以计算两个实体或两个方块之间的距离。对于实体,请使用
/aputils calc distance entities;对于方块,请使用/aputils calc distance(注意这里没有entities)。
- 编辑玩家数据
- 通常,您无法使用
/data或/execute store (result|success) entity来更改玩家实体数据,系统会报错“Unable to modify player data”且不会进行任何更改。有了此模组,该限制被移除,从而可以轻松修改玩家实体数据。请注意,并非所有内容都可以修改,尝试更改某些值(如 Motion 或 Pos)将无效。请改用其他命令如/aputils velocity或/tp来更改这些属性。 - Paper 版本不可用。
- 通常,您无法使用
/aputils velocity <xyz> [add|set|multiply]- 允许以正常方法无法实现的方式操控实体的速度,例如修改玩家的速度(普通的玩家数据修改模组无法做到这一点,因为它不会向客户端发送速度更新数据包)。
- 需要权限等级 2,即在单人世界中需要开启作弊,或在服务器中拥有权限等级 2。
/aputils attack_cooldown <player>- 输出指定玩家的攻击冷却进度百分比(如果配合
/execute store result使用)。
- 输出指定玩家的攻击冷却进度百分比(如果配合
/aputils despawn <entities> [force]- 使一个或多个实体消失。这与
/kill不同,此命令只是从您的世界中移除实体,而不会触发任何死亡事件,而是像实体自然消失那样静默地移除它们。 - 如果未应用
force参数,且目标选择器在命令运行时包含一个或多个玩家(而非选择器允许玩家),则命令失败。 - 需要权限等级 2,如果包含
force则需要权限等级 4。
- 使一个或多个实体消失。这与
/aputils check_damage <entity> [type]- 如果实体在命令运行的刻受到了伤害,且未提供 type 参数,则返回 true。
- 如果提供了 type 参数,且实体在该刻受到了指定类型的伤害,则返回 true。
- 不适用于较旧的游戏版本,测试并兼容的最老版本为 1.21.2。
- 如果所需的 mixin 未加载,此命令始终返回 0。
/aputils pathfind <entity: selector> <xyz: Vec3d> [speed: double]或/aputils pathfind <entity: selector> entity <target: selector> [speed: double]- 使生物使用原版生物寻路机制导航至特定位置。
- 覆盖生物的当前路径(如果有)。
- 有一个可选的 'speed' 参数,使生物在前往指定位置时以该速度移动。请注意,对于某些生物(如铁傀儡),其默认速度(1)即为奔跑速度。这并不适用于所有生物,但适用于部分生物。
- 如果未指定,默认为 1。
- 如果指定的目标是实体,生物将导航至命令运行时该实体所在的位置。
- 不影响海豚,但会影响其他鱼类。具体原因目前尚不清楚,但海豚可能使用了与其他生物不同的导航方法。
- 目前不会产生命令反馈,但它确实有效。
- 生物有时会提前停止导航,这是正常的生物 AI 行为导致的。
/aputils target <entity> <target>- 强制生物将目标更改为指定的实体。
- 忽略距离、游戏模式或已有目标/攻击者等条件。
- 仅适用于可以有目标的生物,因此被动生物不受影响。
- 不影响末影龙,因为末影龙不属于具有正常行为的生物类别。
- 目前不会产生命令反馈,但它确实有效。
数据包可以使用 /aputils heartbeat 检测此模组是否已安装,该命令在向 /execute store result 输出时始终返回 1。
数据包可以使用 /aputils version 检测使用的是 NeoForge 还是 Fabric 版本的模组。如果使用 NeoForge 则返回 1,如果使用 Fabric 则返回 0。
已知问题
- 每次运行
/aputils velocity时,都会向服务器控制台/游戏日志打印 "The new velocity is (x, y, z)",这可能会令人困扰。- 这是一个意外保留的调试功能,将在下一次更新中禁用。
备注
您可以将此模组包含在任何整合包中,无需我的许可。
如果您想将其移植到 Forge,请随意进行。
致开发者
欢迎任何形式的贡献!
趣味事实
这是我整个 Minecraft 开发历史上第一个真正的模组。在此之前,我只制作过 Minecraft 的数据包。
关于正在开发的 Paper 移植版
一直困扰我的是,由于 ADPU 并非插件,我无法在 Paper 这类基于插件的服务器软件上获得某些数据包(如 Old Combat Datapack)的全部功能。因此,我决定自学 Paper 开发,现在 ADPU for Paper 正在正式开发中!需要注意的是,由于 Paper 不支持 Mixin,玩家数据修改和伤害检测等功能将不可用,请对此有所准备。不过,我们将提供一个暂定的 “aputils manipulate” 命令作为变通方案,该命令将在所有加载器上可用,并能够执行诸如修改基于生命值和饥饿值的数值等操作。
Regarding support for various minecraft versions
Lots of changes have been happening recently that has made it difficult for me to support many versions with a single mod jar, so if you need support for a version, make an issue on github and I'll make a branch that supports your version. Otherwise, I will only be otherwise officially supporting the latest version of Minecraft.
About
Andrew's Datapack Utils is a Fabric/NeoForge/Forge/Paper Mod aimed at creating useful utilities for datapacks (mainly for datapack functions). It adds a command which holds most of the utilities, and allows modification of player data using /data and /execute store, allowing for easy manipulation of players and allows for things that were previously impossible.
Features
- Basic Math Calculation
- used by using the
/aputils calc <add|sub|mul|div|power|sqrt|...>command. Works great with/execute store resultand function macroes.
- used by using the
- Distance Calculation
/aputils calc distance <pos 1> <pos 2>or/aputils calc distance entities <selector1> <selector2>- Can calculate distance between 2 entities or 2 blocks, for entities use
/aputils calc distance entities, for blocks use/aputils calc distance(notice the lack ofentities)
- Editing Player Data
- Normally, you can't use
/dataor/execute store (result|success) entityto change player entity data, it just throws an error,Unable to modify player data, and doesn't change anything. With this mod, that restriction is removed, allowing for easy modification of player entity data. Note that not everything can be modified, attempting to change certain values such as Motion or Pos does nothing. Use other commands such as /aputils velocity or /tp to change these instead. - Unavailable on paper.
- Normally, you can't use
/aputils velocity <xyz> [add|set|multiply]- allows you to manipulate the velocity of entities in ways you can't with normal methods, such as modifying the velocity of players (you can't with a player data modification mod because it doesn't send the velocity update packet to the client)
- requires permission level 2, meaning you nead cheats in a single player world or permission level 2 in a server
/aputils attack_cooldown <player>- Outputs the attack cooldown progress of the provided player, as a percent if using
/execute store result.
- Outputs the attack cooldown progress of the provided player, as a percent if using
/aputils despawn <entities> [force]- Despawns one or more entities. Not the same as /kill, as this simply removes the entity/entities from your world without triggering any sort of death event, just silently removing the entity in the same manner as an entity despawning normally.
- If
forceisn't applied and the target selecter includes one or more players at the time of the command being run (not if the selector allows players), the command fails. - Requires permission level 2, or permission level 4 if
forceis included
/aputils check_damage <entity> [type]- Returns true if the entity took damage on the tick the command was run, and type isn't provided
- Returns true if the entity took damage of the provided type on that tick, if type is provided.
- Doesn't work on older game versions, oldest tested and working version is 1.21.2
- This command always returns 0 if the required mixin doesn't load
/aputils pathfind <entity: selector> <xyz: Vec3d> [speed: double]or/aputils pathfind <entity: selector> entity <target: selector> [speed: double]- Makes a mob navigate to a certain position using vanilla mob pathfinding.
- Overrides the mob's current path, if any.
- Has an optional 'speed' parameter that makes the mob move at this speed while travelling to the specified position. Note that for some mobs such as iron golems their default (1) speed is their running speed. This isn't the case for every mob, but it is for some.
- If unspecified, defaults to 1.
- If the target specified is an entity, the mob will navigate to where the entity was when the command was run.
- Does not affect dolphins, but does affect other fish. Why this is I do not currently know, but the dolphin likely uses a different navigation method than other mobs.
- Currently does not produce command feedback, but it does work.
- Mobs sometimes stop navigating to the position early. This is due to normal mob AI behavior.
/aputils target <entity> <target>- Forces a mob to change their target to the specified entity.
- Conditions such as distance, gamemode, or having an existing target/attacker are ignored.
- Only applies to mobs that can have a target, so passive mobs cannot be affected.
- Does not affect to the ender dragon due to the ender dragon not being a mob with normal behavior.
- Currently does not produce command feedback, but it does work.
Datapacks can detect if this mod is installed using
/aputils heartbeat, which always outputs 1 to/execute store result. Datapacks can detect if the NeoForge or Fabric version of the mod is being used with /aputils version. Returns 1 if NeoForge is being used and 0 if Fabric is being used.
Known Issues
- Every time /aputils velocity is run, it prints "The new velocity is (x, y, z)" to the server console/game logs which can be annoying
- This was a debugging feature that was left on accidentally and will be disabled next update.
Notes
This can be included in any modpack without my permission.
If you want to port this to Forge, go ahead.
To Developers
Any contributions would be greatly appreciated!
Fun Facts
This is the first actual mod I've made in my entire history of Minecraft development. Before this I've only ever made datapacks for minecraft.
About the work-in-progress Paper port
It's always bothered me that I can't get the full features of some of my datapacks (like Old Combat Datapack) on a plugin-based server software like Paper due to ADPU not being a Plugin, so I decided to teach myself paper, and now ADPU for Paper is officially in the works! It's important to note that stuff like player data modification and damage checking will not be available due to mixins not being a thing on paper, so be prepared for that. Workarounds will be available though with a work in progress "aputils manipulate" command that will be available on all loaders and will be able to do stuff like modify health-based and hunger-based values, among other things.
下载 Andrew's Datapack Utils
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
下载 Andrew's Datapack Utils
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
修复某项功能又出现在不该出现的位置的问题
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧