當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldClient.getBiomeGenForCoords方法代碼示例

本文整理匯總了Java中net.minecraft.client.multiplayer.WorldClient.getBiomeGenForCoords方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldClient.getBiomeGenForCoords方法的具體用法?Java WorldClient.getBiomeGenForCoords怎麽用?Java WorldClient.getBiomeGenForCoords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.multiplayer.WorldClient的用法示例。


在下文中一共展示了WorldClient.getBiomeGenForCoords方法的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.getBiomeGenForCoords方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。