跳到正文

Simple NPC

作者:WindWaves_Sea

This data pack simplifies the process of configuring vanilla-style NPCs; you simply need to define the storage and execute the spawn function to set up your own NPC.

收藏

介绍

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

English 简体中文

Introduction

This data pack makes configuring NPCs in vanilla Minecraft much easier. Simply write the required data into the storage and execute the summon function to create your own NPC.

Features

The following features are supported:

  • Custom floating text displayed above the NPC.
  • Custom NPC skin.
  • Execute a command or function when the NPC is right-clicked.

Storage Structure

Default Structure (Custom Settings Disabled)

Default Structure (Custom Settings Disabled)

Custom Structure (Custom Settings Enabled)

Custom Structure (Custom Settings Enabled)

Example Storage

Default Configuration

~~~mcfunction
data modify storage windwaves_sea:npc root.npc_setting merge value {\
test:{\
name:”test”,\
zone:”test”,\
config:{\
custom_settings:false,\
look_player:true\
},\
text:{\
pos:{x:1,y:1,z:1},\
text:[{text:”1″}]\
},\
npc:{\
pos:{x:1,y:1,z:1},\
model:”wide”,\
texture:”lobby:npc/start_game”,\
rotation:[180,0]\
},\
right_click:{\
command:””,\(function:””\)
}\
}\
}
~~~

Custom Configuration

~~~mcfunction
data modify storage windwaves_sea:npc root.npc_setting merge value {\
test_custom:{\
name:”test_custom”,\
zone:”test”,\
config:{\
custom_settings:true,\
look_player:true,\
default_orientation:”north” \
},\
text:{\
pos:{x:1,y:1,z:1},\
data:{}\
},\
npc:{\
pos:{x:1,y:1,z:1},\
data:{}\
},\
right_click:{\
function:””\(command:””\)
}\
}\
}
~~~

Command Reference

Summon an NPC

~~~mcfunction
function npc:summon {name:”name”}
~~~

Summons an NPC. The configuration must be written to storage before running this function. Duplicate NPCs cannot be spawned. name refers to the NPC name defined in the configuration above (the same applies below).

Remove an NPC

~~~mcfunction
function npc:remove/npc {name:”name”}
~~~

Remove the Configuration (Also Removes the NPC)

~~~mcfunction
function npc:remove/setting {name:”name”}
~~~


Download

QQ Group: 117464315

GitHub: https://github.com/WindWavesSea/Simple-NPC/

Acknowledgements

Special thanks to NOX OBSCURA for providing the interaction entity size solution, allowing interaction entities to properly match NPC hitboxes.

Special thanks to 轩宇1725 for providing the storage detection approach, enabling string-based detection.

常见问题

Simple NPC 支持哪些 Minecraft 版本?

Simple NPC 支持 Minecraft Java 版 1.21.9–26.2,共 7 个版本。下载时注意选择和你游戏版本一致的文件。

Simple NPC 怎么安装?

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

评论

登录后评论和评分

WindWaves_Sea 的其他作品

查看全部 →