Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void spawnParticles(LivingEntity entity) {
- Random offset = new Random();
- Vector3d box = entity.getBoundingBox().getCenter();
- Vector3d v3d = entity.getLookAngle();
- double pitch = ((v3d.y + 90) * Math.PI) / 180;
- double yaw = ((v3d.x + 90) * Math.PI) / 180;
- double x = Math.sin(pitch) * Math.cos(yaw);
- double y = Math.sin(pitch) * Math.sin(yaw);
- double z = Math.cos(pitch);
- Vector3d look = new Vector3d(x, z, y);
- for (int i = 0; i < 40; ++i) {
- double d0 = (look.x() * this.getStrength()) * 1.5D;
- double d1 = (look.z() * this.getStrength()) * 1.5D;
- entity.level.addParticle(this.getSlamParticle(), box.x, box.y, box.z, d0 * offset.nextDouble(), 0, d1 * offset.nextDouble());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement