Files
2025-08-25 18:36:29 +08:00

50 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
front: https://nie.res.netease.com/r/pic/20210730/ee109f39-8987-46e0-9fe7-40ebb23060fa.png
hard: 入门
time: 20分钟
---
# 为NPC设置工作区域
当所有的NPC准备就绪后需要让他们回到自己的工作岗位并且不能乱跑满足这个条件可以有如下解决方案
- 直接删除下方的的移动行为,使其只能待在原地 这种方法最简单粗暴将NPC放置在哪就一直会在原地非常安全但我们的NPC也就失去了“生机”非常死板不是很推荐此方法
```json
"minecraft:movement": {
"value": 0.25
},
"minecraft:navigation.walk": {
"can_path_over_water": true,
"can_pass_doors": true,
"can_open_doors": true,
"avoid_water": true
},
"minecraft:movement.basic": {
},
```
- 删除NPC闲逛的行为使其只能走去睡觉但是白天他就会一直待在醒来的地方
```json
"minecraft:behavior.random_stroll": {
"priority": 7,
"speed_multiplier": 1
},
```
- 最好的方法也最简单,就是利用方块将其封在一个固定的区域内,让其可以在区域内闲逛
![4](./images/7.gif)
除了以上的方法,肯定还有更好的方案等待发掘,本篇教程点到为止,为大家提供简单的解决方案。