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


Java World.setBlockToAir方法代码示例

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


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

示例1: onNeighborChangeInternal

import net.minecraft.world.World; //导入方法依赖的package包/类
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) {
	if (!this.checkForDrop(worldIn, pos, state)) {
		return true;
	} else {
		EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
		EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
		EnumFacing enumfacing1 = enumfacing.getOpposite();
		boolean flag = false;

		if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) {
			flag = true;
		} else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) {
			flag = true;
		}

		if (flag) {
			this.dropBlockAsItem(worldIn, pos, state, 0);
			worldIn.setBlockToAir(pos);
			return true;
		} else {
			return false;
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:BlockTorch.java

示例2: checkForDrop

import net.minecraft.world.World; //导入方法依赖的package包/类
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state)
{
    if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, (EnumFacing)state.getValue(FACING)))
    {
        return true;
    }
    else
    {
        if (worldIn.getBlockState(pos).getBlock() == this)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
        }

        return false;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:BlockTorch.java

示例3: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing.getOpposite());
    IBlockState iblockstate = worldIn.getBlockState(blockpos);

    if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston)
    {
        worldIn.setBlockToAir(pos);
    }
    else
    {
        iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockPistonExtension.java

示例4: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    if (!this.canBlockStay(worldIn, pos))
    {
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockCake.java

示例5: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11)
    {
        this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:BlockSnowBlock.java

示例6: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
   @Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
	if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP))
	{
		this.dropBlockAsItem(worldIn, pos, state, 0);
		worldIn.setBlockToAir(pos);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:11,代码来源:BlockBoulderOre.java

示例7: drawJump

import net.minecraft.world.World; //导入方法依赖的package包/类
private void drawJump(World world, Palette palette)
{
    int platformLeft = (this.left + this.right)/2 - 1;
    int platformFront = (this.front + this.back)/2 - 1;
    int platformBottom = this.below.y;
                
    // only works for a room height of 4 and floor height of 2
    
    if(this.hint){
    	setBlockState(world, new BlockPos(platformLeft, platformBottom - 1, platformFront - 1), palette.hint);
    	setBlockState(world, new BlockPos(platformLeft, platformBottom + 5, platformFront), palette.hint);
    }
    
    setBlockState(world, new BlockPos(platformLeft, platformBottom, platformFront), palette.platform);
    
    setBlockState(world, new BlockPos(platformLeft, platformBottom, platformFront + 1), palette.light);
    
    setBlockState(world, new BlockPos(platformLeft, platformBottom, platformFront + 2), palette.platform);
    setBlockState(world, new BlockPos(platformLeft, platformBottom + 1, platformFront + 2), palette.platform);
    
    setBlockState(world, new BlockPos(platformLeft + 2, platformBottom + 2, platformFront + 2), palette.platform);
    setBlockState(world, new BlockPos(platformLeft + 3, platformBottom + 2, platformFront + 2), palette.floor);
    setBlockState(world, new BlockPos(platformLeft + 3, platformBottom + 3, platformFront + 2), palette.floor);
    setBlockState(world, new BlockPos(platformLeft + 3, platformBottom + 3, platformFront + 3), palette.light, null, Facing.SOUTH, null);
    
    setBlockState(world, new BlockPos(platformLeft + 3, platformBottom + 3, platformFront), palette.floor);
    setBlockState(world, new BlockPos(platformLeft + 3, platformBottom + 3, platformFront - 1), palette.light, null, Facing.NORTH, null);
    setBlockState(world, new BlockPos(platformLeft + 2, platformBottom + 3, platformFront), palette.platform);
    
    world.setBlockToAir(new BlockPos(platformLeft + 1, platformBottom + 5, platformFront));
    setBlockState(world, new BlockPos(platformLeft + 1, platformBottom + 6, platformFront + 1), palette.light);
    
    for(int i = 0; i<3; i++){
        world.setBlockToAir(new BlockPos(platformLeft + i, platformBottom + 4, platformFront + 2));
        world.setBlockToAir(new BlockPos(platformLeft + i, platformBottom + 5, platformFront + 2));
        world.setBlockToAir(new BlockPos(platformLeft + 2, platformBottom + 4, platformFront + 2 - i));
        world.setBlockToAir(new BlockPos(platformLeft + 2, platformBottom + 5, platformFront + 2 - i));
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:40,代码来源:ClassroomDecoratorImplementation.java

示例8: growTree

import net.minecraft.world.World; //导入方法依赖的package包/类
public void growTree(World world, BlockPos bp, Random rand)
{
	IBlockState state = world.getBlockState(bp);
	int meta = this.getMetaFromState(state);
	String name = this.getMetaName(meta);
	world.setBlockToAir(bp);
	FirmaTree worldGen = FirmaBiome.getTreeGen(name);
	if (worldGen != null){
		worldGen.set(FirmaMod.log2.getStateFromMeta(meta), FirmaMod.leaf2.getStateFromMeta(meta));
		worldGen.generate(world, rand, bp);
	}
}
 
开发者ID:trigg,项目名称:Firma,代码行数:13,代码来源:SaplingBlock2.java

示例9: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called after the block is set in the Chunk data, but before the Tile Entity is set
 */
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    super.onBlockAdded(worldIn, pos, state);

    if (worldIn.isBlockPowered(pos))
    {
        this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:BlockTNT.java

示例10: checkForDrop

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.canBlockStay(worldIn, pos))
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
        worldIn.setBlockToAir(pos);
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:BlockCarpet.java

示例11: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
	if (!worldIn.isRemote) {
		if (this.canPlaceBlockAt(worldIn, pos)) {
			this.updateSurroundingRedstone(worldIn, pos, state);
		} else {
			this.dropBlockAsItem(worldIn, pos, state, 0);
			worldIn.setBlockToAir(pos);
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:BlockRedstoneWire.java

示例12: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (worldIn.isBlockPowered(pos))
    {
        this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:BlockTNT.java

示例13: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity())
    {
        if (worldIn.provider.doesWaterVaporize())
        {
            worldIn.setBlockToAir(pos);
        }
        else
        {
            this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
            worldIn.setBlockState(pos, Blocks.water.getDefaultState());
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:BlockIce.java

示例14: teleport

import net.minecraft.world.World; //导入方法依赖的package包/类
private void teleport(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this)
    {
        for (int i = 0; i < 1000; ++i)
        {
            BlockPos blockpos = pos.add(worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16), worldIn.rand.nextInt(8) - worldIn.rand.nextInt(8), worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16));

            if (worldIn.getBlockState(blockpos).getBlock().blockMaterial == Material.air)
            {
                if (worldIn.isRemote)
                {
                    for (int j = 0; j < 128; ++j)
                    {
                        double d0 = worldIn.rand.nextDouble();
                        float f = (worldIn.rand.nextFloat() - 0.5F) * 0.2F;
                        float f1 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F;
                        float f2 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F;
                        double d1 = (double)blockpos.getX() + (double)(pos.getX() - blockpos.getX()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        double d2 = (double)blockpos.getY() + (double)(pos.getY() - blockpos.getY()) * d0 + worldIn.rand.nextDouble() * 1.0D - 0.5D;
                        double d3 = (double)blockpos.getZ() + (double)(pos.getZ() - blockpos.getZ()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        worldIn.spawnParticle(EnumParticleTypes.PORTAL, d1, d2, d3, (double)f, (double)f1, (double)f2, new int[0]);
                    }
                }
                else
                {
                    worldIn.setBlockState(blockpos, iblockstate, 2);
                    worldIn.setBlockToAir(pos);
                }

                return;
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:BlockDragonEgg.java

示例15: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    super.onBlockAdded(worldIn, pos, state);

    if (worldIn.isBlockPowered(pos))
    {
        this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:BlockTNT.java


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