当前位置: 首页>>代码示例>>Java>>正文


Java WorldClient.getPrecipitationHeight方法代码示例

本文整理汇总了Java中net.minecraft.client.multiplayer.WorldClient.getPrecipitationHeight方法的典型用法代码示例。如果您正苦于以下问题:Java WorldClient.getPrecipitationHeight方法的具体用法?Java WorldClient.getPrecipitationHeight怎么用?Java WorldClient.getPrecipitationHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.multiplayer.WorldClient的用法示例。


在下文中一共展示了WorldClient.getPrecipitationHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRainParticles

import net.minecraft.client.multiplayer.WorldClient; //导入方法依赖的package包/类
private void addRainParticles()
{
    float f = this.mc.theWorld.getRainStrength(1.0F);

    if (!Config.isRainFancy())
    {
        f /= 2.0F;
    }

    if (f != 0.0F && Config.isRainSplash())
    {
        this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
        Entity entity = this.mc.getRenderViewEntity();
        WorldClient worldclient = this.mc.theWorld;
        BlockPos blockpos = new BlockPos(entity);
        byte b0 = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int i = 0;
        int j = (int)(100.0F * f * f);

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

        for (int k = 0; k < j; ++k)
        {
            BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0)));
            BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
            BlockPos blockpos2 = blockpos1.down();
            Block block = worldclient.getBlockState(blockpos2).getBlock();

            if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
            {
                double d3 = this.random.nextDouble();
                double d4 = this.random.nextDouble();

                if (block.getMaterial() == Material.lava)
                {
                    this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                }
                else if (block.getMaterial() != Material.air)
                {
                    block.setBlockBoundsBasedOnState(worldclient, blockpos2);
                    ++i;

                    if (this.random.nextInt(i) == 0)
                    {
                        d0 = (double)blockpos2.getX() + d3;
                        d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
                        d2 = (double)blockpos2.getZ() + d4;
                    }

                    this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                }
            }
        }

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

            if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
            {
                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);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:80,代码来源:EntityRenderer.java

示例2: addRainParticles

import net.minecraft.client.multiplayer.WorldClient; //导入方法依赖的package包/类
private void addRainParticles() {
	float f = this.mc.theWorld.getRainStrength(1.0F);

	if (!Config.isRainFancy()) {
		f /= 2.0F;
	}

	if (f != 0.0F && Config.isRainSplash()) {
		this.random.setSeed((long) this.rendererUpdateCount * 312987231L);
		Entity entity = this.mc.getRenderViewEntity();
		WorldClient worldclient = this.mc.theWorld;
		BlockPos blockpos = new BlockPos(entity);
		byte b0 = 10;
		double d0 = 0.0D;
		double d1 = 0.0D;
		double d2 = 0.0D;
		int i = 0;
		int j = (int) (100.0F * f * f);

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

		for (int k = 0; k < j; ++k) {
			BlockPos blockpos1 = worldclient
					.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0,
							this.random.nextInt(b0) - this.random.nextInt(b0)));
			BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
			BlockPos blockpos2 = blockpos1.down();
			Block block = worldclient.getBlockState(blockpos2).getBlock();

			if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0
					&& biomegenbase.canSpawnLightningBolt()
					&& biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) {
				double d3 = this.random.nextDouble();
				double d4 = this.random.nextDouble();

				if (block.getMaterial() == Material.lava) {
					this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) blockpos1.getX() + d3,
							(double) ((float) blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(),
							(double) blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
				} else if (block.getMaterial() != Material.air) {
					block.setBlockBoundsBasedOnState(worldclient, blockpos2);
					++i;

					if (this.random.nextInt(i) == 0) {
						d0 = (double) blockpos2.getX() + d3;
						d1 = (double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
						d2 = (double) blockpos2.getZ() + d4;
					}

					this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double) blockpos2.getX() + d3,
							(double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(),
							(double) blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
				}
			}
		}

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

			if (d1 > (double) (blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos)
					.getY() > MathHelper.floor_float((float) blockpos.getY())) {
				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);
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:73,代码来源:EntityRenderer.java


注:本文中的net.minecraft.client.multiplayer.WorldClient.getPrecipitationHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。