Fix flying pathfinder not setting yaw correctly

This commit is contained in:
fullwall 2016-01-01 12:51:45 +08:00
parent 829cc1ef63
commit 214b113575
2 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,9 @@
package net.citizensnpcs.npc.ai;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.util.Vector;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType;
@ -16,10 +20,6 @@ import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_8_R3.MathHelper;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.util.Vector;
public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
private final NPC npc;
private final NavigatorParameters parameters;
@ -102,7 +102,9 @@ public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
NMS.setVerticalMovement(npc.getEntity(), 0.5);
if (npc.getEntity().getType() != EntityType.ENDER_DRAGON) {
NMS.setHeadYaw(NMS.getHandle(npc.getEntity()), current.getYaw() + normalisedTargetYaw);
float newYaw = current.getYaw() + normalisedTargetYaw;
NMS.setHeadYaw(NMS.getHandle(npc.getEntity()), newYaw);
NMS.getHandle(npc.getEntity()).yaw = newYaw;
}
parameters.run();
plan.run(npc);

View File

@ -1,5 +1,12 @@
package net.citizensnpcs.npc.entity;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.npc.CitizensNPC;
@ -11,13 +18,6 @@ import net.minecraft.server.v1_8_R3.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
public class EnderDragonController extends MobEntityController {
public EnderDragonController() {
super(EntityEnderDragonNPC.class);