當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。