add data method for compatibleParticles

This commit is contained in:
jascotty2 2019-09-10 17:52:47 -05:00
parent a55bfa8b29
commit 5625c096ce

View File

@ -171,13 +171,12 @@ public class CompatibleParticleHandler {
public static void spawnParticles(ParticleType type, Location location, int count) { public static void spawnParticles(ParticleType type, Location location, int count) {
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) { if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) {
LegacyParticleEffects.createParticle(location, type.compatibleEffect);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
float xx = (float) (1 * (Math.random() - Math.random())); float xx = (float) (1 * (Math.random() - Math.random()));
float yy = (float) (1 * (Math.random() - Math.random())); float yy = (float) (1 * (Math.random() - Math.random()));
float zz = (float) (1 * (Math.random() - Math.random())); float zz = (float) (1 * (Math.random() - Math.random()));
Location at = location.clone().add(xx, yy, zz); Location at = location.clone().add(xx, yy, zz);
LegacyParticleEffects.createParticle(at, LegacyParticleEffects.Type.REDSTONE); LegacyParticleEffects.createParticle(at, type.compatibleEffect);
} }
} else { } else {
location.getWorld().spawnParticle((Particle) type.particle, location, count); location.getWorld().spawnParticle((Particle) type.particle, location, count);
@ -186,19 +185,32 @@ public class CompatibleParticleHandler {
public static void spawnParticles(ParticleType type, Location location, int count, double offsetX, double offsetY, double offsetZ) { public static void spawnParticles(ParticleType type, Location location, int count, double offsetX, double offsetY, double offsetZ) {
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) { if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) {
LegacyParticleEffects.createParticle(location, type.compatibleEffect);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
float xx = (float) (offsetX * (Math.random() - Math.random())); float xx = (float) (offsetX * (Math.random() - Math.random()));
float yy = (float) (offsetY * (Math.random() - Math.random())); float yy = (float) (offsetY * (Math.random() - Math.random()));
float zz = (float) (offsetZ * (Math.random() - Math.random())); float zz = (float) (offsetZ * (Math.random() - Math.random()));
Location at = location.clone().add(xx, yy, zz); Location at = location.clone().add(xx, yy, zz);
LegacyParticleEffects.createParticle(at, LegacyParticleEffects.Type.REDSTONE); LegacyParticleEffects.createParticle(at, type.compatibleEffect);
} }
} else { } else {
location.getWorld().spawnParticle((Particle) type.particle, location, count, offsetX, offsetY, offsetZ); location.getWorld().spawnParticle((Particle) type.particle, location, count, offsetX, offsetY, offsetZ);
} }
} }
public static void spawnParticles(ParticleType type, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) {
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_8)) {
for (int i = 0; i < count; i++) {
float xx = (float) (offsetX * (Math.random() - Math.random()));
float yy = (float) (offsetY * (Math.random() - Math.random()));
float zz = (float) (offsetZ * (Math.random() - Math.random()));
Location at = location.clone().add(xx, yy, zz);
LegacyParticleEffects.createParticle(at, type.compatibleEffect, 0F, 0F, 0F, (float) extra, 0, null);
}
} else {
location.getWorld().spawnParticle((Particle) type.particle, location, count, offsetX, offsetY, offsetZ, extra);
}
}
public static void redstoneParticles(Location location, int red, int green, int blue) { public static void redstoneParticles(Location location, int red, int green, int blue) {
redstoneParticles(location, red, green, blue, 1F, 1, 0); redstoneParticles(location, red, green, blue, 1F, 1, 0);
} }