本文整理汇总了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;
}
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
示例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());
}
}
}
示例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;
}
}
}
}
示例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);
}
}