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


Java BiomeGenBase.getFloatTemperature方法代碼示例

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


在下文中一共展示了BiomeGenBase.getFloatTemperature方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canBlockFreeze

import net.minecraft.world.biome.BiomeGenBase; //導入方法依賴的package包/類
/**
 * Checks to see if a given block is both water and cold enough to freeze.
 */
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.getFloatTemperature(pos);

    if (f > 0.15F)
    {
        return false;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if ((block == Blocks.water || block == Blocks.flowing_water) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
            {
                if (!noWaterAdj)
                {
                    return true;
                }

                boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());

                if (!flag)
                {
                    return true;
                }
            }
        }

        return false;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:World.java

示例2: canSnowAt

import net.minecraft.world.biome.BiomeGenBase; //導入方法依賴的package包/類
/**
 * Checks to see if a given block can accumulate snow from it snowing
 */
public boolean canSnowAt(BlockPos pos, boolean checkLight)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.getFloatTemperature(pos);

    if (f > 0.15F)
    {
        return false;
    }
    else if (!checkLight)
    {
        return true;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            Block block = this.getBlockState(pos).getBlock();

            if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
            {
                return true;
            }
        }

        return false;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:32,代碼來源:World.java

示例3: getSkyColor

import net.minecraft.world.biome.BiomeGenBase; //導入方法依賴的package包/類
/**
 * Calculates the color for the skybox
 */
public Vec3 getSkyColor(Entity entityIn, float partialTicks)
{
    float f = this.getCelestialAngle(partialTicks);
    float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
    int i = MathHelper.floor_double(entityIn.posX);
    int j = MathHelper.floor_double(entityIn.posY);
    int k = MathHelper.floor_double(entityIn.posZ);
    BlockPos blockpos = new BlockPos(i, j, k);
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos);
    float f2 = biomegenbase.getFloatTemperature(blockpos);
    int l = biomegenbase.getSkyColorByTemp(f2);
    float f3 = (float)(l >> 16 & 255) / 255.0F;
    float f4 = (float)(l >> 8 & 255) / 255.0F;
    float f5 = (float)(l & 255) / 255.0F;
    f3 = f3 * f1;
    f4 = f4 * f1;
    f5 = f5 * f1;
    float f6 = this.getRainStrength(partialTicks);

    if (f6 > 0.0F)
    {
        float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F;
        float f8 = 1.0F - f6 * 0.75F;
        f3 = f3 * f8 + f7 * (1.0F - f8);
        f4 = f4 * f8 + f7 * (1.0F - f8);
        f5 = f5 * f8 + f7 * (1.0F - f8);
    }

    float f10 = this.getThunderStrength(partialTicks);

    if (f10 > 0.0F)
    {
        float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F;
        float f9 = 1.0F - f10 * 0.75F;
        f3 = f3 * f9 + f11 * (1.0F - f9);
        f4 = f4 * f9 + f11 * (1.0F - f9);
        f5 = f5 * f9 + f11 * (1.0F - f9);
    }

    if (this.lastLightningBolt > 0)
    {
        float f12 = (float)this.lastLightningBolt - partialTicks;

        if (f12 > 1.0F)
        {
            f12 = 1.0F;
        }

        f12 = f12 * 0.45F;
        f3 = f3 * (1.0F - f12) + 0.8F * f12;
        f4 = f4 * (1.0F - f12) + 0.8F * f12;
        f5 = f5 * (1.0F - f12) + 1.0F * f12;
    }

    return new Vec3((double)f3, (double)f4, (double)f5);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:61,代碼來源:World.java

示例4: addRainParticles

import net.minecraft.world.biome.BiomeGenBase; //導入方法依賴的package包/類
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);
        Entity entity = this.mc.getRenderViewEntity();
        World world = this.mc.theWorld;
        BlockPos blockpos = new BlockPos(entity);
        int i = 10;
        double d0 = 0.0D;
        double d1 = 0.0D;
        double d2 = 0.0D;
        int j = 0;
        int k = (int)(100.0F * f * f);

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

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

            if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && 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(world, blockpos2);
                    ++j;

                    if (this.random.nextInt(j) == 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 (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
        {
            this.rainSoundCounter = 0;

            if (d1 > (double)(blockpos.getY() + 1) && world.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:Notoh,項目名稱:DecompiledMinecraft,代碼行數:80,代碼來源:EntityRenderer.java

示例5: addRainParticles

import net.minecraft.world.biome.BiomeGenBase; //導入方法依賴的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

示例6: addRainParticles

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