當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。