当前位置: 首页>>代码示例>>Java>>正文


Java Location.subtract方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:18,代码来源:ColoredHeartEffect.java

示例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);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:18,代码来源:RainbowHeartEffect.java

示例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++;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:24,代码来源:SparkRingEffect.java

示例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);
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:25,代码来源:RainyDayEffect.java

示例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++;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:18,代码来源:CustomWarpEffect.java

示例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;
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:24,代码来源:BloodHelixEffect.java

示例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);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:23,代码来源:SwirlyEffect.java

示例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);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:25,代码来源:WaterSpoutEffect.java

示例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);
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:26,代码来源:EmeraldStarEffect.java

示例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);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:35,代码来源:InfernoTagEffect.java

示例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++;
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:29,代码来源:FlameBreathEffect.java

示例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;
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:19,代码来源:Hologram.java

示例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);
       }
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:14,代码来源:Valkyrie.java

示例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;
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:29,代码来源:EnderSwapDisplayer.java

示例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);
}
 
开发者ID:Mindgamesnl,项目名称:UselessCode,代码行数:11,代码来源:DumbDropTowerTest.java


注:本文中的org.bukkit.Location.subtract方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。