public EntityRailgunFX(EntityPlayer player) {
    super(player);
    new Motion3D(player, true).applyToEntity(this);

    this.life = 50;
    this.blendInTime = 150;
    this.widthShrinkTime = 800;
    this.widthWiggleRadius = 0.3;
    this.maxWiggleSpeed = 0.8;
    this.blendOutTime = 1000;
    this.length = 45.0;

    ignoreFrustumCheck = true;

    // Build the arc list
    {
      double cur = 1.0;
      double len = this.length;

      while (cur <= len) {
        float theta = RandUtils.rangef(0, MathUtils.PI_F * 2);
        double r = RandUtils.ranged(0.1, 0.25);
        Vec3 vec = VecUtils.vec(cur, r * MathHelper.sin(theta), r * MathHelper.cos(theta));
        vec.rotateAroundZ(rotationPitch * MathUtils.PI_F / 180);
        vec.rotateAroundY((270 - rotationYaw) * MathUtils.PI_F / 180);
        arcHandler.generateAt(vec);

        cur += RandUtils.ranged(1, 2);
      }
    }
  }
Example #2
0
    public void enterState() {
      SwingSilencer silencer = getItem().getAction("SwingSilencer");
      if (silencer != null) {
        silencer.active = false;
      }
      EntityPlayer player = getPlayer();
      player.swingItem();

      if (!isRemote()) {
        Vec3 vec1 =
            Vec3.createVectorHelper(player.posX, player.posY + player.eyeHeight, player.posZ);
        Vec3 vec2 = VecUtils.add(vec1, VecUtils.multiply(player.getLookVec(), 1.5));
        MovingObjectPosition ret =
            Raytrace.perform(player.worldObj, vec1, vec2, EntitySelectors.excludeOf(player));
        if (ret != null && ret.typeOfHit == MovingObjectType.ENTITY) {
          ret.entityHit.attackEntityFrom(DamageSource.causePlayerDamage(player), stockDamage);
          player.worldObj.playSoundAtEntity(player, "dawn47:weapons.stock_attack", 0.5f, 1.0f);
        } else player.worldObj.playSoundAtEntity(player, "dawn47:weapons.stock_swing", 0.5f, 1.0f);
      }
    }