本文整理匯總了Java中org.bukkit.util.Vector.clone方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector.clone方法的具體用法?Java Vector.clone怎麽用?Java Vector.clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.util.Vector
的用法示例。
在下文中一共展示了Vector.clone方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stepLocation
import org.bukkit.util.Vector; //導入方法依賴的package包/類
private void stepLocation(Entity ent, Location to, double blocksPerTick) {
if (!ent.isValid())
return;
Location from = ent.getLocation();
World world = from.getWorld();
Vector fv = new Vector(from.getX(), from.getY(), from.getZ());
Vector tv = new Vector(to.getX(), to.getY(), to.getZ());
double bpt = blocksPerTick;
Vector dv = new Vector(0d, 0d, 0d);
dv.add(tv);
dv.subtract(fv);
Vector nv = dv.clone();
nv.multiply(1 / dv.length() * bpt);
if (nv.length() > dv.length())
return;
nv.add(fv);
Location nl = new Location(world, nv.getX(), nv.getY(), nv.getZ());
nl.setDirection(dv);
ent.teleport(nl);
}
示例2: pitchedNormal
import org.bukkit.util.Vector; //導入方法依賴的package包/類
public Vector pitchedNormal(Vector delta) {
delta = delta.clone();
delta.setY(0);
if(delta.isZero()) return Vectors.ZERO;
delta.normalize();
final double theta = Math.toRadians(pitch);
final double cos = Math.cos(theta);
delta.set(cos * delta.getX(),
Math.sin(theta),
cos * delta.getZ());
return delta;
}
示例3: ArmorStandData
import org.bukkit.util.Vector; //導入方法依賴的package包/類
public ArmorStandData(Connection connection, Vector location) {
this.connection = connection;
this.location = location.clone();
}
示例4: setLocation
import org.bukkit.util.Vector; //導入方法依賴的package包/類
public void setLocation(Vector vector) {
this.location = vector.clone();
if (hologram != null) {
hologram.updateLocation(connection, location.clone());
}
}