Advertisement
Guest User

Untitled

a guest
Jul 28th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1.     public void spawnParticles(LivingEntity entity) {
  2.         Random offset = new Random();
  3.         Vector3d box = entity.getBoundingBox().getCenter();
  4.         Vector3d v3d = entity.getLookAngle();
  5.         double pitch = ((v3d.y + 90) * Math.PI) / 180;
  6.         double yaw = ((v3d.x + 90) * Math.PI) / 180;
  7.         double x = Math.sin(pitch) * Math.cos(yaw);
  8.         double y = Math.sin(pitch) * Math.sin(yaw);
  9.         double z = Math.cos(pitch);
  10.         Vector3d look = new Vector3d(x, z, y);
  11.  
  12.         for (int i = 0; i < 40; ++i) {
  13.             double d0 = (look.x() * this.getStrength()) * 1.5D;
  14.             double d1 = (look.z() * this.getStrength()) * 1.5D;
  15.             entity.level.addParticle(this.getSlamParticle(), box.x, box.y, box.z, d0 * offset.nextDouble(), 0, d1 * offset.nextDouble());
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement