素素子
生成一个盔甲架后 朝向是固定的
尝试了armorStand.getEyeLocation().set
并没有什么 用  有大佬能提供个思路吗

b1250447239
创建一个location,设置它的pitch和yaw,再把盔甲加tp过去

结冰的离季
这是我一个项目的源码
  1. //修改盔甲架面向实体
  2. private void changeDirectionTo(ArmorStand armorStand, Entity entity) {
  3.     Vector direction = getVector(armorStand).subtract(getVector(entity)).normalize();
  4.     double x = direction.getX();
  5.     double y = direction.getY();
  6.     double z = direction.getZ();
  7.     Location changed = armorStand.getLocation().clone();
  8.     changed.setYaw(180 - toDegree(Math.atan2(x, z)));
  9.     changed.setPitch(90 - toDegree(Math.acos(y)));
  10.     armorStand.teleport(changed);
  11. }
  12. private float toDegree(double angle) {
  13.     return (float) Math.toDegrees(angle);
  14. }
  15. private Vector getVector(Entity entity) {
  16.     if (entity instanceof Player)
  17.         return ((Player) entity).getEyeLocation().toVector();
  18.     else
  19.         return entity.getLocation().toVector();
  20. }
复制代码

1468249892
不晓得 看不懂 就是过来过任务

第一页 上一页 下一页 最后一页