Guest User

Untitled

a guest
Jul 27th, 2021
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void slam(LivingEntity user) {
  2.         if (user.isAlive()) {
  3.             Vector3d look = user.getLookAngle();
  4.             double d0 = (look.x() * this.getStrength()) * 1.5D;
  5.             double d1 = (look.z() * this.getStrength()) * 1.5D;
  6.             for (Entity entity : user.level.getEntitiesOfClass(LivingEntity.class, user.getBoundingBox().expandTowards(d0, 1.25D, d1), ENTITY)) {
  7.                 if (entity != user) {
  8.                     entity.hurt(DamageSource.mobAttack(user), this.getAttackDamage() / 2);
  9.                     this.launch(entity, user);
  10.                 }
  11.             }
  12.         }
  13.     }
  14.     public void spawnParticles(LivingEntity entity) {
  15.         Random offset = new Random();
  16.         Vector3d vector3d = entity.getBoundingBox().getCenter();
  17.         Vector3d look = entity.getLookAngle();
  18.         for (int i = 0; i < 40; ++i) {
  19.             double d0 = (look.x() * this.getStrength()) * 1.5D;
  20.             double d1 = (look.z() * this.getStrength()) * 1.5D;
  21.             entity.level.addParticle(this.getSlamParticle(), vector3d.x, vector3d.y, vector3d.z, d0 * offset.nextDouble(), 0, d1 * offset.nextDouble());
  22.         }
  23.     }
RAW Paste Data