mirror of
https://github.com/SunNetservers/Launchpad.git
synced 2025-07-01 21:54:44 +02:00
Adds a cube particle option
This commit is contained in:
@ -30,4 +30,9 @@ public enum ParticleMode {
|
||||
*/
|
||||
SPHERE,
|
||||
|
||||
/**
|
||||
* Spawns the set amount of particles in a cube centered on the block
|
||||
*/
|
||||
CUBE,
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public class ParticleSpawner implements Runnable {
|
||||
case CIRCLE -> drawCircle(world, location);
|
||||
case PYRAMID -> drawPyramid(world, location);
|
||||
case SPHERE -> drawSphere(world, location);
|
||||
case CUBE -> drawCube(world, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,6 +82,26 @@ public class ParticleSpawner implements Runnable {
|
||||
return this.particleConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns a cube of particles at the given location
|
||||
*
|
||||
* @param world <p>The world to spawn the particles in</p>
|
||||
* @param location <p>The location of the block to spawn the particles at</p>
|
||||
*/
|
||||
private void drawCube(@NotNull World world, @NotNull Location location) {
|
||||
// Draw the top and bottom of the cube
|
||||
drawSquare(world, location);
|
||||
drawSquare(world, location.clone().add(0, 1, 0));
|
||||
|
||||
for (float y = 0; y <= 1; y += getParticleConfig().getParticleDensity()) {
|
||||
double height = getParticleConfig().getHeightOffset() + y;
|
||||
spawnParticle(world, location.clone().add(0, height, 0));
|
||||
spawnParticle(world, location.clone().add(0, height, 1));
|
||||
spawnParticle(world, location.clone().add(1, height, 0));
|
||||
spawnParticle(world, location.clone().add(1, height, 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns a sphere of particles at the given location
|
||||
*
|
||||
|
@ -25,7 +25,7 @@ launchpad:
|
||||
particles:
|
||||
# Whether to enable particles above launchpads
|
||||
enabled: false
|
||||
# The mode used for spawning particles. Valid values are: SINGLE, SQUARE, PYRAMID, SPHERE and CIRCLE
|
||||
# The mode used for spawning particles. Valid values are: SINGLE, SQUARE, PYRAMID, SPHERE, CUBE and CIRCLE
|
||||
mode: SQUARE
|
||||
# The type of particle to spawn. See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Particle.html
|
||||
type: DRIP_LAVA
|
||||
|
Reference in New Issue
Block a user