Fixed particles not spawning for small entities

This commit is contained in:
Sollace 2020-05-07 13:14:46 +02:00
parent c5074c41de
commit d9b6c3f6e0

View file

@ -12,10 +12,10 @@ import net.minecraft.particle.ParticleEffect;
public final class ParticleUtils { public final class ParticleUtils {
public static void spawnParticles(ParticleEffect particleId, Entity entity, int count) { public static void spawnParticles(ParticleEffect particleId, Entity entity, int count) {
double halfDist = entity.getStandingEyeHeight() / 1.5; double halfDist = Math.abs(entity.getStandingEyeHeight() / 1.5);
double middle = entity.getBoundingBox().y1 + halfDist; double middle = entity.getBoundingBox().y1 + halfDist;
Shape shape = new Sphere(false, (float)halfDist + entity.getWidth()); Shape shape = new Sphere(false, Math.abs((float)halfDist + entity.getWidth()));
shape.randomPoints(count, entity.world.random).forEach(point -> { shape.randomPoints(count, entity.world.random).forEach(point -> {
entity.world.addParticle(particleId, entity.world.addParticle(particleId,