Java 类net.minecraft.client.particle.EntityRainFX 实例源码

项目:4Space-5    文件:EntityRenderer.java   
private void addRainParticles()
{
    float f = this.mc.theWorld.getRainStrength(1.0F);
    if (!this.mc.gameSettings.fancyGraphics) {
        f /= 2.0F;
    }
    if (f != 0.0F)
    {
        this.random.setSeed(this.rendererUpdateCount * 312987231L);
        EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
        WorldClient worldclient = this.mc.theWorld;
        int i = MathHelper.floor_double(entitylivingbase.posX);
        int j = MathHelper.floor_double(entitylivingbase.posY);
        int k = MathHelper.floor_double(entitylivingbase.posZ);
        byte b0 = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int l = 0;
        int i1 = (int)(100.0F * f * f);
        if (this.mc.gameSettings.particleSetting == 1) {
            i1 >>= 1;
        } else if (this.mc.gameSettings.particleSetting == 2) {
            i1 = 0;
        }
        for (int j1 = 0; j1 < i1; j1++)
        {
            int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0);
            int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0);
            int i2 = worldclient.getPrecipitationHeight(k1, l1);
            Block block = worldclient.getBlock(k1, i2 - 1, l1);
            BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1);
            if ((i2 <= j + b0) && (i2 >= j - b0) && (biomegenbase.canSpawnLightningBolt()) && (biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F))
            {
                float f1 = this.random.nextFloat();
                float f2 = this.random.nextFloat();
                if (block.getMaterial() == Material.lava)
                {
                    this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2, 0.0D, 0.0D, 0.0D));
                }
                else if (block.getMaterial() != Material.air)
                {
                    l++;
                    if (this.random.nextInt(l) == 0)
                    {
                        d0 = k1 + f1;
                        d1 = i2 + 0.1F - block.getBlockBoundsMinY();
                        d2 = l1 + f2;
                    }
                    this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2));
                }
            }
        }
        if ((l > 0) && (this.random.nextInt(3) < this.rainSoundCounter++))
        {
            this.rainSoundCounter = 0;
            if ((d1 > entitylivingbase.posY + 1.0D) && (worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY))) {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
            } else {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
            }
        }
    }
}
项目:4Space-1.7    文件:EntityRenderer.java   
private void addRainParticles()
{
    float f = this.mc.theWorld.getRainStrength(1.0F);
    if (!this.mc.gameSettings.fancyGraphics) {
        f /= 2.0F;
    }
    if (f != 0.0F)
    {
        this.random.setSeed(this.rendererUpdateCount * 312987231L);
        EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
        WorldClient worldclient = this.mc.theWorld;
        int i = MathHelper.floor_double(entitylivingbase.posX);
        int j = MathHelper.floor_double(entitylivingbase.posY);
        int k = MathHelper.floor_double(entitylivingbase.posZ);
        byte b0 = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int l = 0;
        int i1 = (int)(100.0F * f * f);
        if (this.mc.gameSettings.particleSetting == 1) {
            i1 >>= 1;
        } else if (this.mc.gameSettings.particleSetting == 2) {
            i1 = 0;
        }
        for (int j1 = 0; j1 < i1; j1++)
        {
            int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0);
            int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0);
            int i2 = worldclient.getPrecipitationHeight(k1, l1);
            Block block = worldclient.getBlock(k1, i2 - 1, l1);
            BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1);
            if ((i2 <= j + b0) && (i2 >= j - b0) && (biomegenbase.canSpawnLightningBolt()) && (biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F))
            {
                float f1 = this.random.nextFloat();
                float f2 = this.random.nextFloat();
                if (block.getMaterial() == Material.lava)
                {
                    this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2, 0.0D, 0.0D, 0.0D));
                }
                else if (block.getMaterial() != Material.air)
                {
                    l++;
                    if (this.random.nextInt(l) == 0)
                    {
                        d0 = k1 + f1;
                        d1 = i2 + 0.1F - block.getBlockBoundsMinY();
                        d2 = l1 + f2;
                    }
                    this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, k1 + f1, i2 + 0.1F - block.getBlockBoundsMinY(), l1 + f2));
                }
            }
        }
        if ((l > 0) && (this.random.nextInt(3) < this.rainSoundCounter++))
        {
            this.rainSoundCounter = 0;
            if ((d1 > entitylivingbase.posY + 1.0D) && (worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY))) {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
            } else {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
            }
        }
    }
}
项目:Cauldron    文件:EntityRenderer.java   
private void addRainParticles()
{
    float f = this.mc.theWorld.getRainStrength(1.0F);

    if (!this.mc.gameSettings.fancyGraphics)
    {
        f /= 2.0F;
    }

    if (f != 0.0F)
    {
        this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
        EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
        WorldClient worldclient = this.mc.theWorld;
        int i = MathHelper.floor_double(entitylivingbase.posX);
        int j = MathHelper.floor_double(entitylivingbase.posY);
        int k = MathHelper.floor_double(entitylivingbase.posZ);
        byte b0 = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int l = 0;
        int i1 = (int)(100.0F * f * f);

        if (this.mc.gameSettings.particleSetting == 1)
        {
            i1 >>= 1;
        }
        else if (this.mc.gameSettings.particleSetting == 2)
        {
            i1 = 0;
        }

        for (int j1 = 0; j1 < i1; ++j1)
        {
            int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0);
            int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0);
            int i2 = worldclient.getPrecipitationHeight(k1, l1);
            Block block = worldclient.getBlock(k1, i2 - 1, l1);
            BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1);

            if (i2 <= j + b0 && i2 >= j - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F)
            {
                float f1 = this.random.nextFloat();
                float f2 = this.random.nextFloat();

                if (block.getMaterial() == Material.lava)
                {
                    this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2), 0.0D, 0.0D, 0.0D));
                }
                else if (block.getMaterial() != Material.air)
                {
                    ++l;

                    if (this.random.nextInt(l) == 0)
                    {
                        d0 = (double)((float)k1 + f1);
                        d1 = (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY();
                        d2 = (double)((float)l1 + f2);
                    }

                    this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2)));
                }
            }
        }

        if (l > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
        {
            this.rainSoundCounter = 0;

            if (d1 > entitylivingbase.posY + 1.0D && worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY))
            {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
            }
            else
            {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
            }
        }
    }
}
项目:Cauldron    文件:EntityRenderer.java   
private void addRainParticles()
{
    float f = this.mc.theWorld.getRainStrength(1.0F);

    if (!this.mc.gameSettings.fancyGraphics)
    {
        f /= 2.0F;
    }

    if (f != 0.0F)
    {
        this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
        EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
        WorldClient worldclient = this.mc.theWorld;
        int i = MathHelper.floor_double(entitylivingbase.posX);
        int j = MathHelper.floor_double(entitylivingbase.posY);
        int k = MathHelper.floor_double(entitylivingbase.posZ);
        byte b0 = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int l = 0;
        int i1 = (int)(100.0F * f * f);

        if (this.mc.gameSettings.particleSetting == 1)
        {
            i1 >>= 1;
        }
        else if (this.mc.gameSettings.particleSetting == 2)
        {
            i1 = 0;
        }

        for (int j1 = 0; j1 < i1; ++j1)
        {
            int k1 = i + this.random.nextInt(b0) - this.random.nextInt(b0);
            int l1 = k + this.random.nextInt(b0) - this.random.nextInt(b0);
            int i2 = worldclient.getPrecipitationHeight(k1, l1);
            Block block = worldclient.getBlock(k1, i2 - 1, l1);
            BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(k1, l1);

            if (i2 <= j + b0 && i2 >= j - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(k1, i2, l1) >= 0.15F)
            {
                float f1 = this.random.nextFloat();
                float f2 = this.random.nextFloat();

                if (block.getMaterial() == Material.lava)
                {
                    this.mc.effectRenderer.addEffect(new EntitySmokeFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2), 0.0D, 0.0D, 0.0D));
                }
                else if (block.getMaterial() != Material.air)
                {
                    ++l;

                    if (this.random.nextInt(l) == 0)
                    {
                        d0 = (double)((float)k1 + f1);
                        d1 = (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY();
                        d2 = (double)((float)l1 + f2);
                    }

                    this.mc.effectRenderer.addEffect(new EntityRainFX(worldclient, (double)((float)k1 + f1), (double)((float)i2 + 0.1F) - block.getBlockBoundsMinY(), (double)((float)l1 + f2)));
                }
            }
        }

        if (l > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
        {
            this.rainSoundCounter = 0;

            if (d1 > entitylivingbase.posY + 1.0D && worldclient.getPrecipitationHeight(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posZ)) > MathHelper.floor_double(entitylivingbase.posY))
            {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
            }
            else
            {
                this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
            }
        }
    }
}
项目:RuneCraftery    文件:EntityRenderer.java   
private void func_78484_h() {
   float var1 = this.field_78531_r.field_71441_e.func_72867_j(1.0F);
   if(!this.field_78531_r.field_71474_y.field_74347_j) {
      var1 /= 2.0F;
   }

   if(var1 != 0.0F) {
      this.field_78537_ab.setSeed((long)this.field_78529_t * 312987231L);
      EntityLivingBase var2 = this.field_78531_r.field_71451_h;
      WorldClient var3 = this.field_78531_r.field_71441_e;
      int var4 = MathHelper.func_76128_c(var2.field_70165_t);
      int var5 = MathHelper.func_76128_c(var2.field_70163_u);
      int var6 = MathHelper.func_76128_c(var2.field_70161_v);
      byte var7 = 10;
      double var8 = 0.0D;
      double var10 = 0.0D;
      double var12 = 0.0D;
      int var14 = 0;
      int var15 = (int)(100.0F * var1 * var1);
      if(this.field_78531_r.field_71474_y.field_74362_aa == 1) {
         var15 >>= 1;
      } else if(this.field_78531_r.field_71474_y.field_74362_aa == 2) {
         var15 = 0;
      }

      for(int var16 = 0; var16 < var15; ++var16) {
         int var17 = var4 + this.field_78537_ab.nextInt(var7) - this.field_78537_ab.nextInt(var7);
         int var18 = var6 + this.field_78537_ab.nextInt(var7) - this.field_78537_ab.nextInt(var7);
         int var19 = var3.func_72874_g(var17, var18);
         int var20 = var3.func_72798_a(var17, var19 - 1, var18);
         BiomeGenBase var21 = var3.func_72807_a(var17, var18);
         if(var19 <= var5 + var7 && var19 >= var5 - var7 && var21.func_76738_d() && var21.func_76743_j() >= 0.2F) {
            float var22 = this.field_78537_ab.nextFloat();
            float var23 = this.field_78537_ab.nextFloat();
            if(var20 > 0) {
               if(Block.field_71973_m[var20].field_72018_cp == Material.field_76256_h) {
                  this.field_78531_r.field_71452_i.func_78873_a(new EntitySmokeFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x(), (double)((float)var18 + var23), 0.0D, 0.0D, 0.0D));
               } else {
                  ++var14;
                  if(this.field_78537_ab.nextInt(var14) == 0) {
                     var8 = (double)((float)var17 + var22);
                     var10 = (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x();
                     var12 = (double)((float)var18 + var23);
                  }

                  this.field_78531_r.field_71452_i.func_78873_a(new EntityRainFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.field_71973_m[var20].func_83008_x(), (double)((float)var18 + var23)));
               }
            }
         }
      }

      if(var14 > 0 && this.field_78537_ab.nextInt(3) < this.field_78534_ac++) {
         this.field_78534_ac = 0;
         if(var10 > var2.field_70163_u + 1.0D && var3.func_72874_g(MathHelper.func_76128_c(var2.field_70165_t), MathHelper.func_76128_c(var2.field_70161_v)) > MathHelper.func_76128_c(var2.field_70163_u)) {
            this.field_78531_r.field_71441_e.func_72980_b(var8, var10, var12, "ambient.weather.rain", 0.1F, 0.5F, false);
         } else {
            this.field_78531_r.field_71441_e.func_72980_b(var8, var10, var12, "ambient.weather.rain", 0.2F, 1.0F, false);
         }
      }

   }
}