跳到正文

lib

作者:Player_X_YT

More functions for datapack creators

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

A basic library mod for datapack creators. This does nothing on its own!

To create your own datapack simply download the included template file for easy access to all of the features.

As of the latest version this library includes the following features:

Predicates

Sneaking

If the targeted player is pressing the crouch key, lib:sneaking will be true

Wand

If the player is holding a wooden axe and is in creative mode, lib:can_wield_wand will be true

Callbacks

On join

When a player joins the world or server, functions in the #lib:on_join tag will be called as the player that joined

On first join

When a player joins the world or server for the first time, functions in the #lib:on_first_join tag will be called as the player that joined

Functions

Raycasting

To start a raycast, run the lib:raycast function as the entity from which to cast the ray with the following arguments:

| Argument | Data type | Description |
|:-:|:-:|:-:|
| max_distance | int | A positive integer representing the max distance in tenths of a block |
| anchor | eyes \| feet | How to anchor the raycast |
| callback | string | The callback function |

Example:

/execute as @p run function lib:raycast {"max_distance":200,"anchor":"eyes","callback":"example:raycast_callback"}

常见问题

lib 支持哪些 Minecraft 版本?

lib 支持 Minecraft Java 版 1.19.4–1.21.8,共 17 个版本。下载时注意选择和你游戏版本一致的文件。

lib 怎么安装?

新建世界时在「数据包」里把下载的 .zip 拖进去;已有的存档,把文件放进存档目录下的 datapacks 文件夹,进游戏输入 /reload 即可生效。服务器同样放在世界目录的 datapacks 里。

评论

登录后评论和评分

Player_X_YT 的其他作品

查看全部 →