示例#1
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   this.motionX *= 0.9;
   this.motionY += 0.003;
   this.motionZ *= 0.9;
   if (random.nextInt(3) == 0 && this.particleAge < this.particleMaxAge) {
     this.particleAge++;
   }
   float lifeCoeff =
       ((float) this.particleMaxAge - (float) this.particleAge) / (float) this.particleMaxAge;
   this.particleRed = Math.min(1.0f, (float) colorR * (1.0f - lifeCoeff) + lifeCoeff);
   this.particleGreen = Math.min(1.0f, (float) colorG * (1.0f - lifeCoeff) + lifeCoeff);
   this.particleBlue = Math.min(1.0f, (float) colorB * (1.0f - lifeCoeff) + lifeCoeff);
   this.particleAlpha = lifeCoeff;
   this.particleScale = lifeCoeff;
   if (lifeCoeff > 0.5) {
     this.particleScale = 5.0f + 5.0f * (1.0f - lifeCoeff);
   }
   if (lifeCoeff <= 0.5) {
     this.particleScale = 10.0f * (lifeCoeff);
   }
   field_190015_G = field_190014_F;
   field_190014_F += 1.0f;
 }
示例#2
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   float lifeCoeff =
       ((float) this.particleMaxAge - (float) this.particleAge) / (float) this.particleMaxAge;
   this.particleRed = Math.min(1.0f, (float) colorR * (1.5f - lifeCoeff) + lifeCoeff);
   this.particleGreen = Math.min(1.0f, (float) colorG * (1.5f - lifeCoeff) + lifeCoeff);
   this.particleBlue = Math.min(1.0f, (float) colorB * (1.5f - lifeCoeff) + lifeCoeff);
   this.particleAlpha = lifeCoeff;
 }