Script de partículas

Crea una esfera de partículas alrededor de una entidad. Versión Bukkit.
 avatar
unknown
javascript
2 years ago
696 B
10
Indexable
// Versión Bukkit
// EFECTOS: https://helpch.at/docs/1.7.10/index.html?org/bukkit/Effect.html
var Effect = Java.type("org.bukkit.Effect");

particleSphere(player.getLocation(), 2, 50, Effect.FLAME, 0);

function particleSphere(location, radius, particles, effect, data) {
    var phi = Math.PI * (3 - Math.sqrt(5));
    
    for (var i = 0; i < particles; i++) {
        var y = 1 - (i / (particles - 1)) * 2;
        var radius2 = Math.sqrt(1 - y * y) * radius;
        var theta = i * phi;

        location.clone()
            .add(Math.cos(theta) * radius2, y * radius, Math.sin(theta) * radius2)
            .getWorld()
            .playEffect(loc, effect, data);
    }
}
Editor is loading...