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


Java Blocks.water方法代码示例

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


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

示例1: doWaterEffect

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
@Override
public void doWaterEffect() // Called when this entity moves through water
{ 
	// Checking for water here and turning it into ice
	int x = (int) this.posX;
	int y = (int) this.posY;
	int z = (int) this.posZ;
	
	Block hitBlock = this.worldObj.getBlock(x, y, z);
	
	if (hitBlock == Blocks.water || hitBlock == Blocks.flowing_water)
	{
		// Hit a (flowing) water block, so turning that into ice now
		this.worldObj.setBlock(x, y, z, Blocks.ice, 0, 3);
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:17,代码来源:SnowShot.java

示例2: getPathPointTo

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * Returns given entity's position as PathPoint
 */
public PathPoint getPathPointTo(Entity entityIn)
{
    int i;

    if (this.canSwim && entityIn.isInWater())
    {
        i = (int)entityIn.getEntityBoundingBox().minY;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));

        for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
        {
            ++i;
            blockpos$mutableblockpos.func_181079_c(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
        }

        this.avoidsWater = false;
    }
    else
    {
        i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D);
    }

    return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:WalkNodeProcessor.java

示例3: getPathablePosY

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * Gets the safe pathing Y position for the entity depending on if it can path swim or not
 */
private int getPathablePosY()
{
    if (this.theEntity.isInWater() && this.getCanSwim())
    {
        int i = (int)this.theEntity.getEntityBoundingBox().minY;
        Block block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock();
        int j = 0;

        while (block == Blocks.flowing_water || block == Blocks.water)
        {
            ++i;
            block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock();
            ++j;

            if (j > 16)
            {
                return (int)this.theEntity.getEntityBoundingBox().minY;
            }
        }

        return i;
    }
    else
    {
        return (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:PathNavigateGround.java

示例4: ChunkProviderGenerate

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_)
{
    this.worldObj = worldIn;
    this.mapFeaturesEnabled = p_i45636_4_;
    this.field_177475_o = worldIn.getWorldInfo().getTerrainType();
    this.rand = new Random(p_i45636_2_);
    this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
    this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
    this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
    this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
    this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
    this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
    this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
    this.field_147434_q = new double[825];
    this.parabolicField = new float[25];

    for (int i = -2; i <= 2; ++i)
    {
        for (int j = -2; j <= 2; ++j)
        {
            float f = 10.0F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F);
            this.parabolicField[i + 2 + (j + 2) * 5] = f;
        }
    }

    if (p_i45636_5_ != null)
    {
        this.settings = ChunkProviderSettings.Factory.jsonToFactory(p_i45636_5_).func_177864_b();
        this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water;
        worldIn.func_181544_b(this.settings.seaLevel);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:ChunkProviderGenerate.java

示例5: genTerrainBlocks

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    double d0 = GRASS_COLOR_NOISE.func_151601_a((double)p_180622_4_ * 0.25D, (double)p_180622_5_ * 0.25D);

    if (d0 > 0.0D)
    {
        int i = p_180622_4_ & 15;
        int j = p_180622_5_ & 15;

        for (int k = 255; k >= 0; --k)
        {
            if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air)
            {
                if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water)
                {
                    chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState());

                    if (d0 < 0.12D)
                    {
                        chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState());
                    }
                }

                break;
            }
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:BiomeGenSwamp.java

示例6: canBlockFreeze

import net.minecraft.init.Blocks; //导入方法依赖的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:SkidJava,项目名称:BaseClient,代码行数:39,代码来源:World.java

示例7: getStaticBlock

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public static BlockStaticLiquid getStaticBlock(Material materialIn) {
	if (materialIn == Material.water) {
		return Blocks.water;
	} else if (materialIn == Material.lava) {
		return Blocks.lava;
	} else {
		throw new IllegalArgumentException("Invalid material");
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:BlockLiquid.java

示例8: canPlaceBlockOn

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * is the block grass, dirt or farmland
 */
protected boolean canPlaceBlockOn(Block ground)
{
    return ground == Blocks.water;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:8,代码来源:BlockLilyPad.java

示例9: onImpact

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) 		// We hit a living thing!
   	{		
		// Damage
		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
           target.entityHit.hurtResistantTime = 0;	// No immunity frames
           
           // Fire
           target.entityHit.setFire(fireDuration);
       }
	else 
       { 
       	Block block = this.worldObj.getBlock(target.blockX, target.blockY, target.blockZ);
		
		// Glass breaking
       	Helper.tryBlockBreak(this.worldObj, this, target, 2);	// Strong
           
       	// Let's create fire here
       	if (block != Blocks.fire)
       	{
       		if (this.worldObj.getBlock(target.blockX, target.blockY + 1, target.blockZ).isAir(this.worldObj, target.blockX, target.blockY + 1, target.blockZ))
        	{
        		// the block above the block we hit is air, so let's set it on fire!
        		this.worldObj.setBlock(target.blockX, target.blockY + 1, target.blockZ, Blocks.fire, 0, 3);
        	}
       		// else, not an airblock above this
       	}
       	
       	// Have we hit snow? Turning that into snow layer
       	else if (block == Blocks.snow)
       	{
       		this.worldObj.setBlock(target.blockX, target.blockY, target.blockZ, Blocks.snow_layer, 7, 3);
       	}
       	
       	// Have we hit snow layer? Melting that down into nothing
       	else if (block == Blocks.snow_layer)
       	{
       		int currentMeta = this.worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ);
       		// Is this taller than 0? Melting it down then
       		if (currentMeta > 0) { this.worldObj.setBlock(target.blockX, target.blockY, target.blockZ, Blocks.snow_layer, currentMeta - 1, 3); }
       		// Is this 0 already? Turning it into air
       		else { this.worldObj.setBlockToAir(target.blockX, target.blockY, target.blockZ); }
       	}
       	
       	// Have we hit ice? Turning that into water
       	else if (block == Blocks.ice)
       	{
       		this.worldObj.setBlock(target.blockX, target.blockY, target.blockZ, Blocks.water, 0, 3);
       	}
       	
       	// Have we hit (flowing) water? Evaporating that
       	else if (block == Blocks.water || block == Blocks.flowing_water)
       	{
       		this.worldObj.setBlockToAir(target.blockX, target.blockY, target.blockZ);
       	}
       }
	
	// SFX
	NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 4, (byte) 2);
	this.worldObj.playSoundAtEntity(this, "fireworks.largeBlast", 0.7F, 1.5F);
	
	// Going through terrain until our time runs out, but don't damage anything
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:66,代码来源:SunLight.java

示例10: func_176170_a

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public static int func_176170_a(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors)
{
    boolean flag = false;
    BlockPos blockpos = new BlockPos(entityIn);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int i = x; i < x + sizeX; ++i)
    {
        for (int j = y; j < y + sizeY; ++j)
        {
            for (int k = z; k < z + sizeZ; ++k)
            {
                blockpos$mutableblockpos.func_181079_c(i, j, k);
                Block block = blockaccessIn.getBlockState(blockpos$mutableblockpos).getBlock();

                if (block.getMaterial() != Material.air)
                {
                    if (block != Blocks.trapdoor && block != Blocks.iron_trapdoor)
                    {
                        if (block != Blocks.flowing_water && block != Blocks.water)
                        {
                            if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.wood)
                            {
                                return 0;
                            }
                        }
                        else
                        {
                            if (avoidWater)
                            {
                                return -1;
                            }

                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }

                    if (entityIn.worldObj.getBlockState(blockpos$mutableblockpos).getBlock() instanceof BlockRailBase)
                    {
                        if (!(entityIn.worldObj.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(entityIn.worldObj.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase))
                        {
                            return -3;
                        }
                    }
                    else if (!block.isPassable(blockaccessIn, blockpos$mutableblockpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.wood))
                    {
                        if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
                        {
                            return -3;
                        }

                        if (block == Blocks.trapdoor || block == Blocks.iron_trapdoor)
                        {
                            return -4;
                        }

                        Material material = block.getMaterial();

                        if (material != Material.lava)
                        {
                            return 0;
                        }

                        if (!entityIn.isInLava())
                        {
                            return -2;
                        }
                    }
                }
            }
        }
    }

    return flag ? 2 : 1;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:80,代码来源:WalkNodeProcessor.java

示例11: onImpact

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) 		// We hit a living thing!
   	{		
		// Damage
		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
       }
	else	// Hit the terrain
   	{
   		Block block = this.worldObj.getBlock(target.blockX, target.blockY, target.blockZ);            
           int meta = this.worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ);
           
           boolean breakThis = true;
           
           // Checking here against invalid blocks
       	if (block == Blocks.bedrock) { breakThis = false; }
       	else if (block == Blocks.water) { breakThis = false; }
       	else if (block == Blocks.flowing_water) { breakThis = false; }
       	else if (block == Blocks.lava) { breakThis = false; }
       	else if (block == Blocks.flowing_lava) { breakThis = false; }
       	else if (block == Blocks.obsidian) { breakThis = false; }
       	else if (block == Blocks.mob_spawner) { breakThis = false; }
       	
       	else if (block.getMaterial() == Material.water) { breakThis = false; }
       	else if (block.getMaterial() == Material.lava) { breakThis = false; }
       	else if (block.getMaterial() == Material.air) { breakThis = false; }
       	else if (block.getMaterial() == Material.portal) { breakThis = false; }
       	
       	else if (block.getHarvestLevel(meta) > 0) { breakThis = false; }
       	else if (block.getBlockHardness(this.worldObj, target.blockX, target.blockY, target.blockZ) > 3) { breakThis = false; }
       	
       	if (this.shootingEntity instanceof EntityPlayerMP)
       	{
       		WorldSettings.GameType gametype = this.worldObj.getWorldInfo().getGameType();
           	BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(this.worldObj, gametype, (EntityPlayerMP) this.shootingEntity, target.blockX, target.blockY, target.blockZ);
              
           	if (event.isCanceled()) { breakThis = false; }	// Not allowed to do this
       	}
           
           if (breakThis)	// Nothing preventing us from breaking this block!
           {            	
           	this.worldObj.setBlockToAir(target.blockX, target.blockY, target.blockZ);
           	block.dropBlockAsItem(this.worldObj, target.blockX, target.blockY, target.blockZ, meta, 0);
           }
   	}
	
	// SFX
	for (int i = 0; i < 4; ++i) { this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); }
	this.worldObj.playSoundAtEntity(this, Block.soundTypeGravel.getBreakSound(), 1.0F, 1.0F);
	
	this.setDead();	// Hit something, so begone.
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:54,代码来源:FlintDust.java

示例12: onImpact

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) 		// We hit a living thing!
   	{		
		// Damage
		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
           target.entityHit.hurtResistantTime = 0;	// No immunity frames
           this.targetsHit += 1;					// Punched through one more entity
           
           // Bonus
           EntityLightningBolt bolt = new EntityLightningBolt(this.worldObj, target.entityHit.posX, target.entityHit.posY, target.entityHit.posZ);
           this.worldObj.addWeatherEffect(bolt);
       }
	else
	{
		// Let's blast through terrain on hit
		
		int x = target.blockX;
		int y = target.blockY;
		int z = target.blockZ;
		
		Block toBeBroken = this.worldObj.getBlock(x, y, z);
		int meta = this.worldObj.getBlockMetadata(x, y, z);
		
		boolean breakThis = true;
		
		if (toBeBroken.getHarvestLevel(meta) > 1) 
		{ 
			breakThis = false; 
			this.targetsHit += 1;	// Thicker materials
		}
		
		if (toBeBroken.getHarvestLevel(meta) > 2) 
		{ 
			breakThis = false; 
			this.targetsHit += 2;	// Even thicker materials
		}
		
		if (toBeBroken.getHarvestLevel(meta) > 3) 
		{ 
			breakThis = false; 
			this.targetsHit += 3;	// Super thick material
		}
		
    	if (toBeBroken.getMaterial() == Material.water) { breakThis = false; }
    	
    	if (toBeBroken == Blocks.water) { breakThis = false; }
    	if (toBeBroken == Blocks.flowing_water) { breakThis = false; }
    	
    	if (toBeBroken == Blocks.obsidian) 
    	{ 
    		breakThis = false; 
    		this.targetsHit += 2;	// Thicker materials
    	}
    	
    	if (toBeBroken == Blocks.iron_block) 
    	{ 
    		breakThis = false; 
    		this.targetsHit += 2;	// Thicker materials
    	}
    	
    	if (breakThis)	// Sorted out all blocks we don't want to break. Checking the rest now
    	{
    		// Glass breaking
        	Helper.tryBlockBreak(this.worldObj, this, target, 3);	// Very Strong
    	}
		
		this.targetsHit += 1;	// Punched through one more block, no matter if we managed to break it
	}
	
	// SFX
	NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 10, (byte) 2);
	this.worldObj.playSoundAtEntity(this, "ambient.weather.thunder", 0.7F, 0.5F);
	
	if (this.targetsHit > this.targetsHitMax) { this.setDead(); }	// Went through the maximum, so ending now
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:78,代码来源:RedLight.java

示例13: getTexture

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public TextureAtlasSprite getTexture(IBlockState state)
{
    Block block = state.getBlock();
    IBakedModel ibakedmodel = this.getModelForState(state);

    if (ibakedmodel == null || ibakedmodel == this.modelManager.getMissingModel())
    {
        if (block == Blocks.wall_sign || block == Blocks.standing_sign || block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.standing_banner || block == Blocks.wall_banner)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak");
        }

        if (block == Blocks.ender_chest)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/obsidian");
        }

        if (block == Blocks.flowing_lava || block == Blocks.lava)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/lava_still");
        }

        if (block == Blocks.flowing_water || block == Blocks.water)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/water_still");
        }

        if (block == Blocks.skull)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/soul_sand");
        }

        if (block == Blocks.barrier)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:items/barrier");
        }
    }

    if (ibakedmodel == null)
    {
        ibakedmodel = this.modelManager.getMissingModel();
    }

    return ibakedmodel.getParticleTexture();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:46,代码来源:BlockModelShapes.java

示例14: isFlowingWater

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean isFlowingWater(BlockPos pos)
{
	IBlockState state = this.worldObj.getBlockState(pos);
	return state.getBlock() == Blocks.water && state.getValue(BlockLiquid.LEVEL) > 0;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:6,代码来源:TileVersatileGenerator.java

示例15: isStaticWater

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean isStaticWater(BlockPos pos)
{
	IBlockState state = this.worldObj.getBlockState(pos);
	return state.getBlock() == Blocks.water && state.getValue(BlockLiquid.LEVEL) == 0;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:6,代码来源:TileVersatileExtractor.java


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