本文整理汇总了Java中org.bukkit.Location.subtract方法的典型用法代码示例。如果您正苦于以下问题:Java Location.subtract方法的具体用法?Java Location.subtract怎么用?Java Location.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Location
的用法示例。
在下文中一共展示了Location.subtract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
location.add(0, 0.5, 0);
for (int i = 0; i < particles; i++) {
float alpha = ((MathUtils.PI / compilation) / particles) * i;
double phi = Math.pow(Math.abs(MathUtils.sin(2 * compilation * alpha)) + factorInnerSpike * Math.abs(MathUtils.sin(compilation * alpha)), 1 / compressYFactorTotal);
Vector vector = new Vector();
vector.setY(phi * (MathUtils.sin(alpha) + MathUtils.cos(alpha)) * yFactor);
vector.setZ(phi * (MathUtils.cos(alpha) - MathUtils.sin(alpha)) * zFactor);
VectorUtils.rotateVector(vector, 0, -location.getYaw() * MathUtils.degreesToRadians + (Math.PI / 2f), 0);
display(particle, location.add(vector), this.clr);
location.subtract(vector);
}
}
示例2: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
location.add(0, 0.5, 0);
for (int i = 0; i < particles; i++) {
float alpha = ((MathUtils.PI / compilation) / particles) * i;
double phi = Math.pow(Math.abs(MathUtils.sin(2 * compilation * alpha)) + factorInnerSpike * Math.abs(MathUtils.sin(compilation * alpha)), 1 / compressYFactorTotal);
Vector vector = new Vector();
vector.setY(phi * (MathUtils.sin(alpha) + MathUtils.cos(alpha)) * yFactor);
vector.setZ(phi * (MathUtils.cos(alpha) - MathUtils.sin(alpha)) * zFactor);
VectorUtils.rotateVector(vector, 0, -location.getYaw() * MathUtils.degreesToRadians + (Math.PI / 2f), 0);
display(particle, location.add(vector), RUtils.randomColor());
location.subtract(vector);
}
}
示例3: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
if (step > rings + PAUSE) {
step = DEFAULT_STEP;
} else if (step > rings) {
step++;
return;
}
double x, y, z;
y = step * grow;
location.add(0, y, 0);
for (int i = 0; i < particles; i++) {
double angle = (double) 2 * Math.PI * i / particles;
x = Math.cos(angle) * radius;
z = Math.sin(angle) * radius;
location.add(x, 0, z);
display(particle, location);
location.subtract(x, 0, z);
}
location.subtract(0, y, 0);
step++;
}
示例4: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
location.add(0, 1.0f, 0);
for (int i = 0; i < 30; i++) {
Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * cloudSize);
display(cloudParticle, location.add(v), cloudColor, 0, 3);
location.subtract(v);
}
Location l = location.add(0, -0.05, 0);
for (int i = 0; i < 15; i++) {
int r = RandomUtils.random.nextInt(3);
double x = RandomUtils.random.nextDouble() * particleRadius;
double z = RandomUtils.random.nextDouble() * particleRadius;
if (r == 1) {
l.add(x, 0, z);
display(mainParticle, l);
l.subtract(x, 0, z);
l.subtract(x, 0, z);
display(mainParticle, l);
l.add(x, 0, z);
}
}
}
示例5: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = loc;
double x, y, z;
y = step * grow;
location.add(0, y, 0);
for (int i = 0; i < particles; i++) {
double angle = (double) 2 * Math.PI * i / particles;
x = Math.cos(angle) * radius;
z = Math.sin(angle) * radius;
location.add(x, 0, z);
display(particle, location);
location.subtract(x, 0, z);
}
location.subtract(0, y, 0);
step++;
}
示例6: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
for (int j = step; j <= step + perTick; j++) {
currY -= 0.025d;
for (int i = 1; i <= strands; i++) {
float ratio = ((float) j) / particles;
double angle = curve * ratio * 2.0f * Math.PI / strands + 2.0f * Math.PI * i / strands + rotation;
double x = Math.cos(angle) * ratio * radius;
double z = Math.sin(angle) * ratio * radius;
double y = currY;
location.add(x, y, z);
display(particle, location);
location.subtract(x, y, z);
}
}
if (step > particles - perTick) {
step = 0;
currY = START_Y;
} else {
step += perTick;
}
}
示例7: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Vector vector = new Vector();
Location location = getLocation();
location.add(0, -1, 0);
for (int i = 0; i < particlesPerIteration; i++) {
step++;
float t = (MathUtils.PI / particles) * step;
float r = MathUtils.sin(t) * size;
float s = 2 * MathUtils.PI * t;
vector.setX(xFactor * r * MathUtils.cos(s) + xOffset);
vector.setZ(zFactor * r * MathUtils.sin(s) + zOffset);
vector.setY(yFactor * size * MathUtils.cos(t) + yOffset);
VectorUtils.rotateVector(vector, xRotation, yRotation, zRotation);
display(particle, location.add(vector));
location.subtract(vector);
}
}
示例8: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
for (int i = 1; i <= strands; i++) {
double angle = 2 * i * Math.PI / strands + rotation;
for (int j = 1; j <= particlesStrand; j++) {
float ratio = (float) j / particlesStrand;
double x, y, z;
x = Math.cos(angle) * radius * ratio;
y = Math.sin(Math.PI * j / particlesStrand) * height;
z = Math.sin(angle) * radius * ratio;
location.add(x, y, z);
display(particle, location);
location.subtract(x, y, z);
}
}
for (int i = 0; i < particlesSpout; i++) {
Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextFloat() * radius * radiusSpout);
v.setY(RandomUtils.random.nextFloat() * heightSpout);
location.add(v);
display(particle, location);
location.subtract(v);
}
}
示例9: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
location.add(0, 2, 0);
float radius = 3 * innerRadius / MathUtils.SQRT_3;
for (int i = 0; i < spikesHalf * 2; i++) {
double xRotation = i * Math.PI / spikesHalf;
for (int x = 0; x < particles; x++) {
double angle = 2 * Math.PI * x / particles;
float height = RandomUtils.random.nextFloat() * spikeHeight;
Vector v = new Vector(Math.cos(angle), 0, Math.sin(angle));
v.multiply((spikeHeight - height) * radius / spikeHeight);
v.setY(innerRadius + height);
VectorUtils.rotateAroundAxisX(v, xRotation);
location.add(v);
display(particle, location);
location.subtract(v);
VectorUtils.rotateAroundAxisX(v, Math.PI);
VectorUtils.rotateAroundAxisY(v, Math.PI / 2);
location.add(v);
display(particle, location);
location.subtract(v);
}
}
}
示例10: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
if (font == null) {
cancel();
return;
}
Location location = getLocation();
location.add(0, 1.2, 0);
if(!lockedYaw) {
yaw = -location.getYaw();
dir = location.getDirection();
dir = dir.normalize().setY(0);
lockedYaw = true;
}
location.add(dir);
try {
if (image == null) {
image = StringParser.stringToBufferedImage(font, text);
}
for (int y = 0; y < image.getHeight(); y += stepY) {
for (int x = 0; x < image.getWidth(); x += stepX) {
int clr = image.getRGB(image.getWidth() - 1 - x, y);
if (clr != Color.black.getRGB())
continue;
Vector v = new Vector((float) image.getWidth() / 2 - x, (float) image.getHeight() / 2 - y, 0).multiply(size);
VectorUtils.rotateAroundAxisY(v, yaw * MathUtils.degreesToRadians);
display(particle, location.add(v));
location.subtract(v);
}
}
} catch (Exception ex) {
cancel(true);
}
}
示例11: onRun
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
Location location = getLocation();
for (int j = 0; j < stepsPerIteration; j++) {
if (step % particles == 0) {
rndF.clear();
rndAngle.clear();
}
while (rndF.size() < arcs) {
rndF.add(RandomUtils.random.nextFloat());
}
while (rndAngle.size() < arcs) {
rndAngle.add(RandomUtils.getRandomAngle());
}
for (int i = 0; i < arcs; i++) {
float pitch = rndF.get(i) * 2 * this.pitch - this.pitch;
float x = (step % particles) * length / particles;
float y = (float) (pitch * Math.pow(x, 2));
Vector v = new Vector(x, y, 0);
VectorUtils.rotateAroundAxisX(v, rndAngle.get(i));
VectorUtils.rotateAroundAxisZ(v, -location.getPitch() * MathUtils.degreesToRadians);
VectorUtils.rotateAroundAxisY(v, -(location.getYaw() + 90) * MathUtils.degreesToRadians);
display(particle, location.add(v));
location.subtract(v);
}
step++;
}
}
示例12: generateLines
import org.bukkit.Location; //导入方法依赖的package包/类
/**
* Generate hologram in world at the given
* location
*
* @param loc Hologram's location
*/
public void generateLines(Location loc)
{
Location first = loc.clone().add(0, (this.lines.size() / 2) * distance, 0);
for (int i = 0; i < this.lines.size(); i++)
{
this.entities.put(i, generateEntitiesForLine(first.clone(), this.lines.get(i)));
first.subtract(0, distance, 0);
}
this.location = loc;
}
示例13: particleCircle
import org.bukkit.Location; //导入方法依赖的package包/类
private void particleCircle(Player player ,int particles, float radius, ParticleEffect particle)
{
Location location = player.getEyeLocation();
for (int i = 0; i < particles; i++) {
double angle, x, z;
angle = 2 * Math.PI * i / particles;
x = Math.cos(angle) * radius;
z = Math.sin(angle) * radius;
location.add(x, -0.3, z);
particle.display(0.05f, 0.05f, 0.05f, 0, 1, location, 64);
location.subtract(x, -0.3, z);
}
}
示例14: EnderSwapDisplayer
import org.bukkit.Location; //导入方法依赖的package包/类
public EnderSwapDisplayer(Hub hub, Player player)
{
super(hub, player);
this.teleportPositions = new ArrayList<>();
Location last = this.baseLocation;
for (int i = 0; i < 10; i++)
{
Location randomizedLocation = last.clone().add(GadgetManager.RANDOM.nextInt(80) - 40, 0, GadgetManager.RANDOM.nextInt(80) - 40);
randomizedLocation.setY(250);
while (randomizedLocation.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
randomizedLocation.subtract(0.0D, 1.0D, 0.0D);
if (randomizedLocation.getBlockY() < 10)
{
randomizedLocation.setY(250);
break;
}
}
this.teleportPositions.add(randomizedLocation);
last = randomizedLocation;
}
}
示例15: moveEntity
import org.bukkit.Location; //导入方法依赖的package包/类
public static void moveEntity(Entity mrobject, Integer decreetogo) {
Location location = new Location(Bukkit.getWorld("world"), 0, flyingheight, 1);
double radians = Math.toRadians(decreetogo);
double x = Math.cos(radians);
double z = Math.sin(radians);
location.add(x * 5.4, 0, z * 5.4);
CommonEntity < ? > commonMinecart = CommonEntity.get(mrobject);
commonMinecart.setLocation(location.getX(), location.getY(), location.getZ(), decreetogo, decreetogo);
location.subtract(x, 0, z);
}