我只是在寻找一种方法来刷出带有AI的NPC,它只是去某个地方而不做任何事情。有人知道怎么做这样的东西吗?
这可以通过使用Citizens2来实现,这是一个为Minecraft 1.8-1.19构建的免费NPC API。
首先,创建NPC:NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "CustomPlayer"); // "CustomPlayer" is the NPC's name
接下来,给NPC一个WanderGoal
,给他们你正在寻找的漫游功能:
npc.getDefaultGoalController().addGoal(WanderGoal.createWithNPC(npc), 1);
最后刷出NPC:
npc.spawn(location);`