
简单NPC
序言
此数据包使原版配置NPC更加简单,只需要写storage并执行生成函数即可配置一个属于你的NPC
功能
支持以下功能:
- 自定义NPC上方的悬浮字。
- 自定义NPC皮肤。
- 右键NPC运行指令或函数。
Storage结构
默认结构(不开启自定义配置)
* name:NPC名称。
* zone:NPC生成的区域。
config: 配置选项。
* custom_settings:自定义配置。
look_player:NPC是否看向玩家。
default_orientation:默认朝向( 如果使用look_player此项为必填)。
* text:悬浮字。
* pos:坐标。
* x: x坐标。
* y: y坐标。
* z: z坐标。
* text: 内含文本组件。
* npc:玩家模型配置。
* pos:坐标。
* x: x坐标。
* y: y坐标。
* z: z坐标。
* model: 玩家模型类型。
* texture: 玩家皮肤<命名空间>:textures/<路径>.png或皮肤链接。
right_click:右键NPC执行。
command:右键执行的指令( 与function任选其一配置)。
function:右键执行的函数( 与command任选其一配置)。
自定义配置结构(开启自定义配置)
* name:NPC名称。
* zone:NPC生成的区域。
config: 配置选项。
* custom_settings:自定义配置( 应该为true )。
look_player:NPC是否看向玩家。
default_orientation:默认朝向(如果使用look_player此项为必填)。
* text:悬浮字。
* pos:坐标。
* x: x坐标。
* y: y坐标。
* z: z坐标。
* data: 参看文本展示实体的实体数据配置
* npc:玩家模型配置。
* pos:坐标。
* x: x坐标。
* y: y坐标。
* z: z坐标。
* data: 参看玩家模型实体数据配置
right_click:右键NPC执行。
command:右键执行的指令(与function任选其一配置)。
function:右键执行的函数(与command任选其一配置)。
示例storage
默认配置
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:""\)
}\
}\
}自定义配置
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:""\)
}\
}\
}指令解析
生成NPC
mcfunction
function npc:summon {name:"name"}生成NPC,需先写入配置,不可重复生成,name为上方配置中的NPC名称(下文相同)。
清除NPC
mcfunction
function npc:remove/npc {name:"name"}删除配置( 同时清除NPC )
mcfunction
function npc:remove/setting {name:"name"}下载
QQ群:117464315
Github:https://github.com/WindWavesSea/Simple-NPC/
Modrinth: https://modrinth.com/datapack/simple-npc/
鸣谢
感谢NOX OBSCURA提供的交互实体大小, 使其可以贴合NPC碰撞箱
感谢轩宇1725提供的storage检测思路,使字符串可以检测