org.bukkit.util.Vector.copy()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.bukkit.util.Vector.copy()方法的一些代码示例,展示了Vector.copy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.copy()方法的具体详情如下:
包路径:org.bukkit.util.Vector
类名称:Vector
方法名:copy

Vector.copy介绍

[英]Copies another vector
[中]复制另一个向量

代码示例

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
public void setVelocity(Vector velocity) {
  this.velocity.copy(velocity);
  velocityChanged = true;
}

代码示例来源:origin: GlowstoneMC/Glowstone

/**
 * Returns a deep copy of a BoundingBox.
 * @param original the BoundingBox to copy
 * @return a copy of {@code original}
 */
public static BoundingBox copyOf(BoundingBox original) {
  BoundingBox box = new BoundingBox();
  box.minCorner.copy(original.minCorner);
  box.maxCorner.copy(original.maxCorner);
  return box;
}

代码示例来源:origin: GlowstoneMC/Glowstone

/**
 * Creates a bounding box given its minimum corner and its size.
 * @param pos the minimum corner
 * @param size the displacement of the maximum corner from the minimum corner
 * @return a bounding box from {@code pos} to {@code pos.clone().add(size)}
 */
public static BoundingBox fromPositionAndSize(Vector pos, Vector size) {
  BoundingBox box = new BoundingBox();
  box.minCorner.copy(pos);
  box.maxCorner.copy(pos.clone().add(size));
  return box;
}

代码示例来源:origin: Slikey/EffectLib

@Override
  public void onRun() {
    Location location = getLocation();
    if (firstStep) {
      velocity.copy(location.getDirection().setY(0).normalize().multiply(0.2));
      invalidate(location);
    }
    location.add(velocity);

    for (Vector v : cloudCache) {
      location.add(v);
      display(cloudParticle, location, cloudColor, 0, 1);
      location.subtract(v);
    }
    for (Vector v : waterCache) {
      location.add(v);
      display(particle, location);
      location.subtract(v);
    }
  }
}

代码示例来源:origin: elBukkit/MagicPlugin

Vector up = new Vector(0, 1, 0);
Vector perp = new Vector();
perp.copy(direction);
perp.crossProduct(up);

相关文章