Java Code Examples for net.minecraft.init.Blocks.FIRE

The following are Jave code examples for showing how to use FIRE of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: CharcoalPit   File: BlockPotteryKiln.java   View Source Code Vote up 6 votes
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
	if(pos.offset(EnumFacing.DOWN).equals(fromPos)&&
			!worldIn.getBlockState(fromPos).isSideSolid(worldIn, fromPos, EnumFacing.UP)){
		worldIn.destroyBlock(pos, true);
		return;
	}
	if(state.getValue(TYPE)==EnumKilnTypes.ACTIVE){
		if(pos.offset(EnumFacing.UP).equals(fromPos)){
			IBlockState fromState=worldIn.getBlockState(fromPos);
			if(fromState.getBlock()==Blocks.FIRE)
				return;
			((TilePotteryKiln)worldIn.getTileEntity(pos)).isValid=false;
		}
		((TilePotteryKiln)worldIn.getTileEntity(pos)).isValid=false;
	}
}
 
Example 2
Project: Backmemed   File: World.java   View Source Code Vote up 6 votes
/**
 * Attempts to extinguish a fire
 */
public boolean extinguishFire(@Nullable EntityPlayer player, BlockPos pos, EnumFacing side)
{
    pos = pos.offset(side);

    if (this.getBlockState(pos).getBlock() == Blocks.FIRE)
    {
        this.playEvent(player, 1009, pos, 0);
        this.setBlockToAir(pos);
        return true;
    }
    else
    {
        return false;
    }
}
 
Example 3
Project: Backmemed   File: EntityEnderCrystal.java   View Source Code Vote up 6 votes
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    ++this.innerRotation;

    if (!this.world.isRemote)
    {
        BlockPos blockpos = new BlockPos(this);

        if (this.world.provider instanceof WorldProviderEnd && this.world.getBlockState(blockpos).getBlock() != Blocks.FIRE)
        {
            this.world.setBlockState(blockpos, Blocks.FIRE.getDefaultState());
        }
    }
}
 
Example 4
Project: CustomWorldGen   File: World.java   View Source Code Vote up 6 votes
/**
 * Attempts to extinguish a fire
 */
public boolean extinguishFire(@Nullable EntityPlayer player, BlockPos pos, EnumFacing side)
{
    pos = pos.offset(side);

    if (this.getBlockState(pos).getBlock() == Blocks.FIRE)
    {
        this.playEvent(player, 1009, pos, 0);
        this.setBlockToAir(pos);
        return true;
    }
    else
    {
        return false;
    }
}
 
Example 5
Project: Bewitchment   File: RitualFlames.java   View Source Code Vote up 5 votes
private boolean canBurn(World world, BlockPos pos) {
	if (!world.isAirBlock(pos))
		return false;
	for (EnumFacing side : EnumFacing.VALUES) {
		BlockPos offset = pos.offset(side);
		if (!world.isAirBlock(pos.offset(side))) {
			Block block = world.getBlockState(offset).getBlock();
			if (block != Blocks.FIRE)
				return true;
		}
	}
	return false;
}
 
Example 6
Project: CharcoalPit   File: PileIgnitr.java   View Source Code Vote up 5 votes
@SubscribeEvent(priority=EventPriority.LOWEST)
public void checkIgnition(NeighborNotifyEvent event){
	if(!event.isCanceled()&&
			event.getWorld().getBlockState(event.getPos()).getBlock()==Blocks.FIRE){
		for(EnumFacing facing:event.getNotifiedSides()){
			BlockPos pos=event.getPos().offset(facing);
			if(event.getWorld().getBlockState(pos).getBlock()==BlocksRegistry.logPile){
				//found log pile to ignite
				igniteLogs(event.getWorld(),pos);
				
			}else if(event.getWorld().getBlockState(pos).getBlock()==Blocks.COAL_BLOCK){
				boolean shouldIgnite=false;
				for(int x=-1;x<=1;x++){
					for(int y=-1;y<=1;y++){
						for(int z=-1;z<=1&&!shouldIgnite;z++){
							BlockPos newpos=pos.add(x, y, z);
							for(String name:Config.CokeBlocks){
								if(event.getWorld().getBlockState(newpos).getBlock().getRegistryName().toString().equals(name)){
									shouldIgnite=true;
									break;
								}
							}
						}
					}
				}
				if(shouldIgnite){
					//found coal pile to ignite
					igniteCoal(event.getWorld(),pos);
				}
			}else if(facing==EnumFacing.DOWN&&event.getWorld().getBlockState(pos).getBlock()==BlocksRegistry.potteryKiln){
				//found pottery kiln to ignite
				ignitePottery(event.getWorld(), pos);
			}
		}
	}
}
 
Example 7
Project: Backmemed   File: World.java   View Source Code Vote up 5 votes
public boolean isFlammableWithin(AxisAlignedBB bb)
{
    int i = MathHelper.floor(bb.minX);
    int j = MathHelper.ceil(bb.maxX);
    int k = MathHelper.floor(bb.minY);
    int l = MathHelper.ceil(bb.maxY);
    int i1 = MathHelper.floor(bb.minZ);
    int j1 = MathHelper.ceil(bb.maxZ);

    if (this.isAreaLoaded(i, k, i1, j, l, j1, true))
    {
        BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = k; l1 < l; ++l1)
            {
                for (int i2 = i1; i2 < j1; ++i2)
                {
                    Block block = this.getBlockState(blockpos$pooledmutableblockpos.setPos(k1, l1, i2)).getBlock();

                    if (block == Blocks.FIRE || block == Blocks.FLOWING_LAVA || block == Blocks.LAVA)
                    {
                        blockpos$pooledmutableblockpos.release();
                        return true;
                    }
                }
            }
        }

        blockpos$pooledmutableblockpos.release();
    }

    return false;
}
 
Example 8
Project: Backmemed   File: EntityPotion.java   View Source Code Vote up 5 votes
private void extinguishFires(BlockPos pos)
{
    if (this.world.getBlockState(pos).getBlock() == Blocks.FIRE)
    {
        this.world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
    }
}
 
Example 9
Project: Backmemed   File: WalkNodeProcessor.java   View Source Code Vote up 5 votes
private PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_)
{
    BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_);
    IBlockState iblockstate = p_189553_1_.getBlockState(blockpos);
    Block block = iblockstate.getBlock();
    Material material = iblockstate.getMaterial();
    return material == Material.AIR ? PathNodeType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathNodeType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathNodeType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.IRON && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_OPEN : (block instanceof BlockRailBase ? PathNodeType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate) || ((Boolean)iblockstate.getValue(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathNodeType.WATER : (material == Material.LAVA ? PathNodeType.LAVA : (block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED))) : PathNodeType.FENCE))))))) : PathNodeType.TRAPDOOR);
}
 
Example 10
Project: CustomWorldGen   File: World.java   View Source Code Vote up 5 votes
public boolean isFlammableWithin(AxisAlignedBB bb)
{
    int i = MathHelper.floor_double(bb.minX);
    int j = MathHelper.ceiling_double_int(bb.maxX);
    int k = MathHelper.floor_double(bb.minY);
    int l = MathHelper.ceiling_double_int(bb.maxY);
    int i1 = MathHelper.floor_double(bb.minZ);
    int j1 = MathHelper.ceiling_double_int(bb.maxZ);

    if (this.isAreaLoaded(i, k, i1, j, l, j1, true))
    {
        BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = k; l1 < l; ++l1)
            {
                for (int i2 = i1; i2 < j1; ++i2)
                {
                    Block block = this.getBlockState(blockpos$pooledmutableblockpos.setPos(k1, l1, i2)).getBlock();

                    if (block == Blocks.FIRE || block == Blocks.FLOWING_LAVA || block == Blocks.LAVA)
                    {
                        blockpos$pooledmutableblockpos.release();
                        return true;
                    }
                    else if (block.isBurning(this, new BlockPos(k1, l1, i2)))
                    {
                        return true;
                    }
                }
            }
        }

        blockpos$pooledmutableblockpos.release();
    }

    return false;
}
 
Example 11
Project: CustomWorldGen   File: WalkNodeProcessor.java   View Source Code Vote up 5 votes
private PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_)
{
    BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_);
    IBlockState iblockstate = p_189553_1_.getBlockState(blockpos);
    Block block = iblockstate.getBlock();
    Material material = iblockstate.getMaterial();
    return material == Material.AIR ? PathNodeType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathNodeType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathNodeType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.IRON && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_OPEN : (block instanceof BlockRailBase ? PathNodeType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate) || ((Boolean)iblockstate.getValue(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathNodeType.WATER : (material == Material.LAVA ? PathNodeType.LAVA : (block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED))) : PathNodeType.FENCE))))))) : PathNodeType.TRAPDOOR);
}
 
Example 12
Project: CustomWorldGen   File: EntityPotion.java   View Source Code Vote up 5 votes
private void extinguishFires(BlockPos pos)
{
    if (this.worldObj.getBlockState(pos).getBlock() == Blocks.FIRE)
    {
        this.worldObj.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
    }
}
 
Example 13
Project: pnc-repressurized   File: HeatBehaviourFireTransition.java   View Source Code Vote up 4 votes
@Override
public boolean isApplicable() {
    return super.isApplicable() && getBlockState().getBlock() == Blocks.FIRE;
}
 
Example 14
Project: CustomWorldGen   File: BlockFalling.java   View Source Code Vote up 4 votes
public static boolean canFallThrough(IBlockState state)
{
    Block block = state.getBlock();
    Material material = state.getMaterial();
    return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
}
 
Example 15
Project: CustomWorldGen   File: WalkNodeProcessor.java   View Source Code Vote up 4 votes
public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z)
{
    PathNodeType pathnodetype = this.getPathNodeTypeRaw(blockaccessIn, x, y, z);

    if (pathnodetype == PathNodeType.OPEN && y >= 1)
    {
        Block block = blockaccessIn.getBlockState(new BlockPos(x, y - 1, z)).getBlock();
        PathNodeType pathnodetype1 = this.getPathNodeTypeRaw(blockaccessIn, x, y - 1, z);
        pathnodetype = pathnodetype1 != PathNodeType.WALKABLE && pathnodetype1 != PathNodeType.OPEN && pathnodetype1 != PathNodeType.WATER && pathnodetype1 != PathNodeType.LAVA ? PathNodeType.WALKABLE : PathNodeType.OPEN;

        if (pathnodetype1 == PathNodeType.DAMAGE_FIRE || block == Blocks.MAGMA)
        {
            pathnodetype = PathNodeType.DAMAGE_FIRE;
        }

        if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS)
        {
            pathnodetype = PathNodeType.DAMAGE_CACTUS;
        }
    }

    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    if (pathnodetype == PathNodeType.WALKABLE)
    {
        for (int j = -1; j <= 1; ++j)
        {
            for (int i = -1; i <= 1; ++i)
            {
                if (j != 0 || i != 0)
                {
                    Block block1 = blockaccessIn.getBlockState(blockpos$pooledmutableblockpos.setPos(j + x, y, i + z)).getBlock();

                    if (block1 == Blocks.CACTUS)
                    {
                        pathnodetype = PathNodeType.DANGER_CACTUS;
                    }
                    else if (block1 == Blocks.FIRE)
                    {
                        pathnodetype = PathNodeType.DANGER_FIRE;
                    }
                }
            }
        }
    }

    blockpos$pooledmutableblockpos.release();
    return pathnodetype;
}
 
Example 16
Project: morefurnaces   File: TileEntityNetherrackFurnace.java   View Source Code Vote up 4 votes
@Override
public boolean isBurning()
{
    return world != null && world.getBlockState(pos.up()).getBlock() == Blocks.FIRE;
}
 
Example 17
Project: Backmemed   File: BlockPortal.java   View Source Code Vote up 4 votes
protected boolean isEmptyBlock(Block blockIn)
{
    return blockIn.blockMaterial == Material.AIR || blockIn == Blocks.FIRE || blockIn == Blocks.PORTAL;
}
 
Example 18
Project: Backmemed   File: BlockFalling.java   View Source Code Vote up 4 votes
public static boolean canFallThrough(IBlockState state)
{
    Block block = state.getBlock();
    Material material = state.getMaterial();
    return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
}
 
Example 19
Project: Backmemed   File: WalkNodeProcessor.java   View Source Code Vote up 4 votes
public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z)
{
    PathNodeType pathnodetype = this.getPathNodeTypeRaw(blockaccessIn, x, y, z);

    if (pathnodetype == PathNodeType.OPEN && y >= 1)
    {
        Block block = blockaccessIn.getBlockState(new BlockPos(x, y - 1, z)).getBlock();
        PathNodeType pathnodetype1 = this.getPathNodeTypeRaw(blockaccessIn, x, y - 1, z);
        pathnodetype = pathnodetype1 != PathNodeType.WALKABLE && pathnodetype1 != PathNodeType.OPEN && pathnodetype1 != PathNodeType.WATER && pathnodetype1 != PathNodeType.LAVA ? PathNodeType.WALKABLE : PathNodeType.OPEN;

        if (pathnodetype1 == PathNodeType.DAMAGE_FIRE || block == Blocks.MAGMA)
        {
            pathnodetype = PathNodeType.DAMAGE_FIRE;
        }

        if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS)
        {
            pathnodetype = PathNodeType.DAMAGE_CACTUS;
        }
    }

    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    if (pathnodetype == PathNodeType.WALKABLE)
    {
        for (int j = -1; j <= 1; ++j)
        {
            for (int i = -1; i <= 1; ++i)
            {
                if (j != 0 || i != 0)
                {
                    Block block1 = blockaccessIn.getBlockState(blockpos$pooledmutableblockpos.setPos(j + x, y, i + z)).getBlock();

                    if (block1 == Blocks.CACTUS)
                    {
                        pathnodetype = PathNodeType.DANGER_CACTUS;
                    }
                    else if (block1 == Blocks.FIRE)
                    {
                        pathnodetype = PathNodeType.DANGER_FIRE;
                    }
                }
            }
        }
    }

    blockpos$pooledmutableblockpos.release();
    return pathnodetype;
}
 
Example 20
Project: CustomWorldGen   File: BlockPortal.java   View Source Code Vote up 4 votes
protected boolean isEmptyBlock(Block blockIn)
{
    return blockIn.blockMaterial == Material.AIR || blockIn == Blocks.FIRE || blockIn == Blocks.PORTAL;
}