diff --git a/pom.xml b/pom.xml index 7c15846..33f51a5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.smallaswater RsNPC - 2.4.4 + 2.4.5-SNAPSHOT RsNPC RsNPC -- NPC plugin for Nukkit diff --git a/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java b/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java index 605c5a8..2badba3 100644 --- a/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java +++ b/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java @@ -138,12 +138,17 @@ public RsNpcConfig(@NonNull String name, @NonNull Config config) throws RsNpcCon if (level == null) { throw new RsNpcLoadException("世界:" + this.levelName + " 不存在!无法加载当前世界的NPC"); } + double yaw = Utils.toDouble(map.getOrDefault("yaw", 0D)); + if (!map.containsKey("headYaw")) { + map.put("headYaw", yaw); + } this.location = new Location( Utils.toDouble(map.get("x")), Utils.toDouble(map.get("y")), Utils.toDouble(map.get("z")), - Utils.toDouble(map.getOrDefault("yaw", 0D)), + yaw, 0, + Utils.toDouble(map.getOrDefault("headYaw", 0D)), level ); } catch (Exception e) { @@ -298,6 +303,7 @@ public void save() { map.put("y", this.location.getY()); map.put("z", this.location.getZ()); map.put("yaw", this.location.getYaw()); + map.put("headYaw", this.location.getHeadYaw()); this.config.set("坐标", map); if (this.itemData != null) { @@ -380,7 +386,7 @@ public void checkEntity() { this.entityRsNpc.setPosition(this.location); } if (!this.lookAtThePlayer) { - this.entityRsNpc.setRotation(this.location.yaw, this.location.pitch); + this.entityRsNpc.setRotation(this.location.yaw, this.location.pitch, this.location.headYaw); } this.entityRsNpc.setNameTag(this.showName /*VariableManage.stringReplace(null, this.showName, this)*/); } diff --git a/src/main/resources/Npc.yml b/src/main/resources/Npc.yml index b26309a..85c3480 100644 --- a/src/main/resources/Npc.yml +++ b/src/main/resources/Npc.yml @@ -8,6 +8,7 @@ nameTagAlwaysVisible: true y: 0 z: 0 yaw: 0.0 + headYaw: 0.0 level: "world" 手持: "267:0" 头部: ""