Esempio n. 1
0
 @EventHandler
 public void snowballParticle(ProjectileHitEvent event) {
   if (!_balls.remove(event.getEntity())) {
     return;
   }
   Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
   loc.getWorld().playSound(loc, Sound.WOLF_BARK, 1.0F, 1.0F);
   ParticleLib18 portal = new ParticleLib18(ParticleLib18.ParticleType.PORTAL, 0.0D, 20, 0.0D);
   ParticleLib18 spark =
       new ParticleLib18(ParticleLib18.ParticleType.FIREWORKS_SPARK, 0.0D, 10, 0.0D);
   portal.sendToLocation(loc.add(0.0D, 1.0D, 0.0D));
   spark.sendToLocation(loc.add(0.0D, 1.0D, 0.0D));
 }
Esempio n. 2
0
  @EventHandler
  public void LocationUpdater(UpdateEvent event) {
    if (event.getType() == UpdateType.TICK) {
      for (Player p : EffectManager.effect3.keySet()) {
        if (EffectManager.getEffect(p) == EffectManager.EffectType.HourGlass) {
          if (p.isValid()) {
            if (ExtraManager.isMoving(p)) {
              Location location = p.getLocation();

              Vector vector = new Vector();

              for (int i = 0; i < this.particlesPerIteration; i++) {
                this.step += 1;

                float t = 3.141593F / this.particles * this.step;
                float r =
                    MathUtils.sin(t * 2.718282F * this.particlesPerIteration / this.particles)
                        * this.size;
                float s = r * 3.141593F * t;

                vector.setX(this.xFactor * r * -MathUtils.cos(s));
                vector.setZ(this.zFactor * r * -MathUtils.sin(s));
                vector.setY(this.yFactor * r + this.yOffset + 2.0F);

                UtilVector.rotateVector(vector, this.xRotation, this.yRotation, this.zRotation);
                ParticleLib18 ench =
                    new ParticleLib18(
                        com.lightcraftmc.particles18.ParticleLib18.ParticleType.ENCHANTMENT_TABLE,
                        0.0D,
                        1,
                        0.0D);
                ench.sendToLocation(location.add(vector));

                location.subtract(vector);
              }

            } else if (!p.isInsideVehicle()) {
              ParticleLib18 ench2 =
                  new ParticleLib18(
                      com.lightcraftmc.particles18.ParticleLib18.ParticleType.ENCHANTMENT_TABLE,
                      0.1000000014901161D,
                      4,
                      0.300000011920929D);
              ench2.sendToLocation(p.getLocation().add(0.0D, 1.0D, 0.0D));
            }
          }
        }
      }
    }
  }