mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 02:25:57 +01:00
Don't set body yaw with head yaw
This commit is contained in:
parent
50caa007e7
commit
06b0e2d800
@ -9,7 +9,7 @@
|
||||
<artifactId>citizens-main</artifactId>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<craftbukkit.version>1.20.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<craftbukkit.version>1.20.4-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<placeholderapi.version>2.11.2</placeholderapi.version>
|
||||
<citizensapi.version>${project.version}</citizensapi.version>
|
||||
<worldguard.version>7.1.0-SNAPSHOT</worldguard.version>
|
||||
|
@ -438,7 +438,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
Location npcLoc = getEntity().getLocation();
|
||||
if (isSpawned() && npcLoc.getWorld() == location.getWorld()) {
|
||||
if (npcLoc.distance(location) < 1) {
|
||||
NMS.setHeadYaw(getEntity(), location.getYaw());
|
||||
NMS.setHeadAndBodyYaw(getEntity(), location.getYaw());
|
||||
}
|
||||
if (getEntity().getType() == EntityType.PLAYER && !getEntity().isInsideVehicle()
|
||||
&& NMS.getPassengers(getEntity()).size() == 0) {
|
||||
|
@ -108,7 +108,7 @@ public class StraightLineNavigationStrategy extends AbstractPathStrategy {
|
||||
}
|
||||
if (npc.getEntity().getType() != EntityType.ENDER_DRAGON) {
|
||||
NMS.setVerticalMovement(npc.getEntity(), 0.5);
|
||||
NMS.setHeadYaw(npc.getEntity(), currLoc.getYaw() + normalisedTargetYaw);
|
||||
NMS.setHeadAndBodyYaw(npc.getEntity(), currLoc.getYaw() + normalisedTargetYaw);
|
||||
}
|
||||
} else if (npc.getEntity() instanceof LivingEntity) {
|
||||
NMS.setDestination(npc.getEntity(), destVector.getX(), destVector.getY(), destVector.getZ(),
|
||||
|
@ -54,9 +54,9 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.MirrorTrait;
|
||||
import net.citizensnpcs.trait.PacketNPC;
|
||||
@ -198,6 +198,10 @@ public class NMS {
|
||||
return BRIDGE.getBoundingBox(handle);
|
||||
}
|
||||
|
||||
public static double getBoundingBoxHeight(Entity entity) {
|
||||
return BRIDGE.getBoundingBoxHeight(entity);
|
||||
}
|
||||
|
||||
public static BoundingBox getCollisionBox(Block block) {
|
||||
if (block.getType() == Material.AIR)
|
||||
return BoundingBox.EMPTY;
|
||||
@ -462,10 +466,6 @@ public class NMS {
|
||||
return BRIDGE.getHeadYaw(entity);
|
||||
}
|
||||
|
||||
public static double getBoundingBoxHeight(Entity entity) {
|
||||
return BRIDGE.getBoundingBoxHeight(entity);
|
||||
}
|
||||
|
||||
public static float getHorizontalMovement(org.bukkit.entity.Entity bukkitEntity) {
|
||||
return BRIDGE.getHorizontalMovement(bukkitEntity);
|
||||
}
|
||||
@ -790,6 +790,10 @@ public class NMS {
|
||||
BRIDGE.setEndermanAngry(enderman, angry);
|
||||
}
|
||||
|
||||
public static void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
BRIDGE.setHeadAndBodyYaw(entity, yaw);
|
||||
}
|
||||
|
||||
public static void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
BRIDGE.setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
@ -74,6 +74,10 @@ public interface NMSBridge {
|
||||
|
||||
public BoundingBox getBoundingBox(Entity handle);
|
||||
|
||||
public default double getBoundingBoxHeight(Entity entity) {
|
||||
return entity.getHeight();
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBox(Block block);
|
||||
|
||||
public Location getDestination(Entity entity);
|
||||
@ -82,10 +86,6 @@ public interface NMSBridge {
|
||||
|
||||
public float getHeadYaw(Entity entity);
|
||||
|
||||
public default double getBoundingBoxHeight(Entity entity) {
|
||||
return entity.getHeight();
|
||||
}
|
||||
|
||||
public float getHorizontalMovement(Entity entity);
|
||||
|
||||
public CompoundTag getNBT(ItemStack item);
|
||||
@ -201,6 +201,8 @@ public interface NMSBridge {
|
||||
|
||||
public void setEndermanAngry(Enderman enderman, boolean angry);
|
||||
|
||||
public void setHeadAndBodyYaw(Entity entity, float yaw);
|
||||
|
||||
public void setHeadYaw(Entity entity, float yaw);
|
||||
|
||||
public void setKnockbackResistance(LivingEntity entity, double d);
|
||||
|
@ -331,7 +331,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
bg *= 0.98F;
|
||||
bh *= 0.9F;
|
||||
moveWithFallDamage(bf, bg); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -167,9 +167,9 @@ import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.ThrownPotionController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.TippedArrowController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.WitherSkullController;
|
||||
import net.citizensnpcs.npc.EntityControllers;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.RotationTrait;
|
||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||
@ -446,6 +446,11 @@ public class NMSImpl implements NMSBridge {
|
||||
return new BoundingBox(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
@ -479,11 +484,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return getHandle((LivingEntity) entity).aQ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
|
||||
if (!entity.getType().isAlive())
|
||||
@ -1201,16 +1201,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aP = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aO = yaw;
|
||||
handle.aO = yaw; // TODO: why this
|
||||
}
|
||||
handle.aQ = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aQ = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -301,7 +301,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
bf *= 0.98F;
|
||||
bg *= 0.9F;
|
||||
moveWithFallDamage(be, bf); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -182,9 +182,9 @@ import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.ThrownPotionController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.TippedArrowController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.WitherSkullController;
|
||||
import net.citizensnpcs.npc.EntityControllers;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.RotationTrait;
|
||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||
@ -466,6 +466,11 @@ public class NMSImpl implements NMSBridge {
|
||||
return new BoundingBox(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
@ -499,11 +504,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return getHandle((LivingEntity) entity).aP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
|
||||
if (!entity.getType().isAlive())
|
||||
@ -1254,16 +1254,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aO = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aN = yaw;
|
||||
handle.aN = yaw; // TODO: why this
|
||||
}
|
||||
handle.aP = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aP = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -318,7 +318,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
bg *= 0.98F;
|
||||
bh *= 0.9F;
|
||||
moveWithFallDamage(be, bf, bg); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1261,16 +1261,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aO = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aN = yaw;
|
||||
handle.aN = yaw; // TODO: why this
|
||||
}
|
||||
handle.aP = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aP = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -294,7 +294,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
bj *= 0.98F;
|
||||
bk *= 0.9F;
|
||||
moveWithFallDamage(bh, bi, bj); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1298,16 +1298,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aR = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aQ = yaw;
|
||||
handle.aQ = yaw; // TODO: why this
|
||||
}
|
||||
handle.aS = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aS = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -298,7 +298,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
bd *= 0.98F;
|
||||
be *= 0.9F;
|
||||
moveWithFallDamage(new Vec3D(this.bb, this.bc, this.bd)); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1332,16 +1332,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aL = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aK = yaw;
|
||||
handle.aK = yaw; // TODO: why this
|
||||
}
|
||||
handle.aM = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aM = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -298,7 +298,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
aZ *= 0.98F;
|
||||
bb *= 0.98F;
|
||||
moveWithFallDamage(new Vec3D(this.aZ, this.ba, this.bb)); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1349,16 +1349,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aJ = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aI = yaw;
|
||||
handle.aI = yaw; // TODO: why this
|
||||
}
|
||||
handle.aK = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aK = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -267,7 +267,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
aR *= 0.98F;
|
||||
aT *= 0.98F;
|
||||
moveWithFallDamage(new Vec3D(this.aR, this.aS, this.aT)); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1378,7 +1378,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
@ -1387,7 +1387,14 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aA = yaw; // TODO: why this
|
||||
}
|
||||
handle.setHeadRotation(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).setHeadRotation(Util.clamp(yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -275,7 +275,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
xxa *= 0.98F;
|
||||
zza *= 0.98F;
|
||||
moveWithFallDamage(new Vec3(this.xxa, this.yya, this.zza));
|
||||
NMS.setHeadYaw(getBukkitEntity(), getYRot());
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), getYRot());
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ public class NMSImpl implements NMSBridge {
|
||||
return;
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.setYRot(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
setHeadAndBodyYaw(entity, yaw);
|
||||
handle.setXRot(pitch);
|
||||
}
|
||||
|
||||
@ -1063,7 +1063,7 @@ public class NMSImpl implements NMSBridge {
|
||||
yaw = yaw - 90;
|
||||
}
|
||||
if (headOnly) {
|
||||
setHeadYaw(entity, (float) yaw);
|
||||
setHeadAndBodyYaw(entity, (float) yaw);
|
||||
} else {
|
||||
look(entity, (float) yaw, (float) pitch);
|
||||
}
|
||||
@ -1378,7 +1378,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
LivingEntity handle = (LivingEntity) getHandle(entity);
|
||||
@ -1387,7 +1387,14 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!(handle instanceof net.minecraft.world.entity.player.Player)) {
|
||||
handle.setYBodyRot(yaw);
|
||||
}
|
||||
handle.setYHeadRot(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((LivingEntity) getHandle(entity)).setYHeadRot(Util.clamp(yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,7 +273,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
xxa *= 0.98F;
|
||||
zza *= 0.98F;
|
||||
moveWithFallDamage(new Vec3(this.xxa, this.yya, this.zza));
|
||||
NMS.setHeadYaw(getBukkitEntity(), getYRot());
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), getYRot());
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1386,7 +1386,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
LivingEntity handle = (LivingEntity) getHandle(entity);
|
||||
@ -1395,7 +1395,14 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!(handle instanceof net.minecraft.world.entity.player.Player)) {
|
||||
handle.setYBodyRot(yaw);
|
||||
}
|
||||
handle.setYHeadRot(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((LivingEntity) getHandle(entity)).setYHeadRot(Util.clamp(yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,7 +273,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
xxa *= 0.98F;
|
||||
zza *= 0.98F;
|
||||
moveWithFallDamage(new Vec3(this.xxa, this.yya, this.zza));
|
||||
NMS.setHeadYaw(getBukkitEntity(), getYRot());
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), getYRot());
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
LivingEntity handle = (LivingEntity) getHandle(entity);
|
||||
@ -1536,7 +1536,14 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!(handle instanceof net.minecraft.world.entity.player.Player)) {
|
||||
handle.setYBodyRot(yaw);
|
||||
}
|
||||
handle.setYHeadRot(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((LivingEntity) getHandle(entity)).setYHeadRot(Util.clamp(yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,7 @@
|
||||
<artifactId>citizens-v1_20_R3</artifactId>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<craftbukkit.version>1.20.3-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<craftbukkit.version>1.20.4-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -52,9 +52,7 @@ public class DolphinController extends MobEntityController {
|
||||
|
||||
public static class EntityDolphinNPC extends Dolphin implements NPCHolder {
|
||||
private boolean inProtectedTick;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private MoveControl oldMoveController;
|
||||
|
||||
public EntityDolphinNPC(EntityType<? extends Dolphin> types, Level level) {
|
||||
|
@ -277,7 +277,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
xxa *= 0.98F;
|
||||
zza *= 0.98F;
|
||||
moveWithFallDamage(new Vec3(this.xxa, this.yya, this.zza));
|
||||
NMS.setHeadYaw(getBukkitEntity(), getYRot());
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), getYRot());
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
LivingEntity handle = (LivingEntity) getHandle(entity);
|
||||
@ -1507,7 +1507,14 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!(handle instanceof net.minecraft.world.entity.player.Player)) {
|
||||
handle.setYBodyRot(yaw);
|
||||
}
|
||||
handle.setYHeadRot(yaw);
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((LivingEntity) getHandle(entity)).setYHeadRot(Util.clamp(yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2552,11 +2559,11 @@ public class NMSImpl implements NMSBridge {
|
||||
Map.class);
|
||||
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,
|
||||
AttributeSupplier.class);
|
||||
private static final MethodHandle AVAILABLE_BEHAVIORS_BY_PRIORITY = NMS.getGetter(Brain.class, "f");
|
||||
private static final Set<EntityType> BAD_CONTROLLER_LOOK = EnumSet.of(EntityType.POLAR_BEAR, EntityType.BEE,
|
||||
EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT,
|
||||
EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST,
|
||||
EntityType.SHULKER, EntityType.PHANTOM);
|
||||
private static final MethodHandle AVAILABLE_BEHAVIORS_BY_PRIORITY = NMS.getGetter(Brain.class, "f");
|
||||
private static final MethodHandle BUKKITENTITY_FIELD_SETTER = NMS.getSetter(Entity.class, "bukkitEntity");
|
||||
private static final MethodHandle CHUNKMAP_UPDATE_PLAYER_STATUS = NMS.getMethodHandle(ChunkMap.class, "a", true,
|
||||
ServerPlayer.class, boolean.class);
|
||||
|
@ -308,7 +308,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
ba *= 0.98F;
|
||||
bb *= 0.9F;
|
||||
moveWithFallDamage(aZ, ba); // movement method
|
||||
NMS.setHeadYaw(getBukkitEntity(), yaw);
|
||||
NMS.setHeadAndBodyYaw(getBukkitEntity(), yaw);
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
}
|
||||
|
@ -156,9 +156,9 @@ import net.citizensnpcs.nms.v1_8_R3.entity.nonliving.TNTPrimedController;
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.nonliving.ThrownExpBottleController;
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.nonliving.WitherSkullController;
|
||||
import net.citizensnpcs.npc.EntityControllers;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.RotationTrait;
|
||||
import net.citizensnpcs.util.EmptyChannel;
|
||||
@ -402,6 +402,11 @@ public class NMSImpl implements NMSBridge {
|
||||
return new BoundingBox(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
@ -433,11 +438,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return getHandle((LivingEntity) entity).aK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBoundingBoxHeight(org.bukkit.entity.Entity entity) {
|
||||
return getHandle(entity).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
|
||||
if (!entity.getType().isAlive())
|
||||
@ -1119,16 +1119,23 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
public void setHeadAndBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aJ = yaw;
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aI = yaw;
|
||||
handle.aI = yaw; // TODO: why this
|
||||
}
|
||||
handle.aK = yaw;
|
||||
setHeadYaw(entity, yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
if (!(entity instanceof org.bukkit.entity.LivingEntity))
|
||||
return;
|
||||
((EntityLiving) getHandle(entity)).aK = Util.clamp(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user