Adjust particle loading to work with webui coordinates

This commit is contained in:
Teriuihi 2025-06-23 00:45:07 +02:00
parent ed91cf6810
commit 02c4f818a0
2 changed files with 15 additions and 13 deletions

View File

@ -83,18 +83,19 @@ public class ParticleConfig {
Class<?> dataType = particleType.getDataType();
// Handle different particle data types
if ((dataType.equals(Particle.DustOptions.class)
|| dataType.equals(Particle.DustTransition.class))) {
if (dataType.equals(Particle.DustOptions.class)) {
if (particleInfo.getColor() != null) {
if (particleInfo.getColorGradientEnd() != null) {
particleBuilder.colorTransition(getColor(particleInfo.getColor()),
getColor(particleInfo.getColorGradientEnd()),
particleInfo.getSize());
} else {
particleBuilder.color(getColor(particleInfo.getColor()));
}
particleBuilder.color(getColor(particleInfo.getColor()),
particleInfo.getSize());
}
} else if (dataType.equals(Color.class)) {
} else if (dataType.equals(Particle.DustTransition.class)) {
if (particleInfo.getColorGradientEnd() != null) {
particleBuilder.colorTransition(getColor(particleInfo.getColor()),
getColor(particleInfo.getColorGradientEnd()),
particleInfo.getSize());
}
}
else if (dataType.equals(Color.class)) {
particleBuilder.color(getColor(particleInfo.getColor()));
} else if (dataType.equals(BlockData.class)) {
particleBuilder.data(Material.STONE.createBlockData());
@ -112,7 +113,8 @@ public class ParticleConfig {
particleBuilder.extra(particleInfo.getExtra());
}
aParticleList.add(new AParticle(x, y, z, randomOffset, particleBuilder));
//Add 0.2 to adjust for the player model being 1.6 blocks high
aParticleList.add(new AParticle(x, y + 0.2, z, randomOffset, particleBuilder));
}
loadedFrames.add(new Frame(aParticleList));

View File

@ -18,7 +18,7 @@ public class Frame {
/**
* Spawns all particles in a frame (CALL ASYNC)
*
* @param location Location to spawn particles at
* @param location Location to spawn particles at
*/
public void spawn(Location location, float rotation) {
Location tmpLocation = location.clone();
@ -28,7 +28,7 @@ public class Frame {
double offsetZ = ((aParticle.offset_range() == 0) ? 0 : current.nextDouble(-aParticle.offset_range(), aParticle.offset_range()));
double offsetY = ((aParticle.offset_range() == 0) ? 0 : current.nextDouble(-aParticle.offset_range(), aParticle.offset_range()));
XZ xz = new XZ(location.getX(), location.getX() + aParticle.x() + offsetX,
location.getZ(), location.getZ() + aParticle.z() + offsetZ,
location.getZ(), location.getZ() + aParticle.z() + offsetZ,
rotation);
aParticle.particleBuilder()
.location(tmpLocation.set(