diff --git a/src/main/java/com/ferreusveritas/dynamictrees/entity/animation/FalloverAnimationHandler.java b/src/main/java/com/ferreusveritas/dynamictrees/entity/animation/FalloverAnimationHandler.java index 62198128b..151f8b233 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/entity/animation/FalloverAnimationHandler.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/entity/animation/FalloverAnimationHandler.java @@ -105,32 +105,41 @@ protected void flingLeavesParticles(FallingTreeEntity entity, float fallSpeed){ if (bounces > 1) return; int maxParticleBlocks = DTConfigs.MAX_FALLING_TREE_LEAVES_PARTICLES.get(); if (maxParticleBlocks == 0) return; - double limitChance = 1; - if (entity.getDestroyData().getNumLeaves() > maxParticleBlocks){ - limitChance = maxParticleBlocks / (double)entity.getDestroyData().getNumLeaves(); - } - limitChance *= Math.exp(-bounces); + BranchDestructionData data = entity.getDestroyData(); Direction.Axis toolAxis = data.toolDir.getAxis(); - int particleCount = bounces == 0 ? (int)(fallSpeed*5) : 1; if (toolAxis == Direction.Axis.Y) return; //this one isn't possible anyways - Vec3 w = entity.getForward().scale(fallSpeed * data.toolDir.getAxisDirection().getStep()); - if (toolAxis == Direction.Axis.X) w = new Vec3(w.z, w.x, w.y); - double speedVar = 0; + + double limitChance = 1; + if (entity.getDestroyData().getNumLeaves() > maxParticleBlocks) + limitChance = maxParticleBlocks / (double)entity.getDestroyData().getNumLeaves(); + limitChance *= Math.exp(-bounces); + RandomSource rand = entity.level().random; + int particleCount = bounces == 0 ? (int)(fallSpeed*5) : 1; + + Vec3 angularVel = entity.getForward().scale(fallSpeed * -data.toolDir.getAxisDirection().getStep()); + //on the X axis, the entity forward is rotated, so we rotate the angular velocity back + if (toolAxis == Direction.Axis.X) angularVel = new Vec3(angularVel.z, angularVel.x, angularVel.y); + for (int i=0; i