Java Code Examples for net.minecraft.init.Blocks#FLOWING_LAVA

The following examples show how to use net.minecraft.init.Blocks#FLOWING_LAVA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockSoyMilk.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private int getHeatStrength(World par1World, BlockPos pos)
{
    for (int i = 1; i < 5; i++)
    {
        Block block = par1World.getBlockState(pos.down(i)).getBlock();
        if (block instanceof BlockFire || block == Blocks.LAVA || block == Blocks.FLOWING_LAVA)
        {
            return i <= 2 ? 2 : 1;
        }
    }
    return 0;
}
 
Example 2
Source File: HeatUtil.java    From Sakura_mod with MIT License 5 votes vote down vote up
public static int getHeatStrength(World par1World, BlockPos pos) {
    for (int i = 1; i < 5; i++) {
        Block block = par1World.getBlockState(pos.down(i)).getBlock();
        if (block instanceof BlockCampfire||block instanceof BlockMagma||block instanceof BlockFire || block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) {
            return i <= 3 ? 2 : 1;
        }
    }
    return 0;
}
 
Example 3
Source File: ItemUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static ItemStack getStateToItemOverride(IBlockState state)
{
    if (state.getBlock() == Blocks.LAVA || state.getBlock() == Blocks.FLOWING_LAVA)
    {
        return new ItemStack(Items.LAVA_BUCKET);
    }
    else if (state.getBlock() == Blocks.WATER || state.getBlock() == Blocks.FLOWING_WATER)
    {
        return new ItemStack(Items.WATER_BUCKET);
    }

    return ItemStack.EMPTY;
}
 
Example 4
Source File: ItemEnderBucket.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *  Attempts to place one fluid block in the world, identified by the given FluidStack
 */
public boolean tryPlaceFluidBlock(World world, BlockPos pos, FluidStack fluidStack)
{
    if (fluidStack == null || fluidStack.getFluid() == null || fluidStack.getFluid().canBePlacedInWorld() == false)
    {
        return false;
    }

    Block block = fluidStack.getFluid().getBlock();

    // We need to convert water and lava to the flowing variant, otherwise we get non-flowing source blocks
    if (block == Blocks.WATER)
    {
        block = Blocks.FLOWING_WATER;
    }
    else if (block == Blocks.LAVA)
    {
        block = Blocks.FLOWING_LAVA;
    }

    IBlockState state = world.getBlockState(pos);
    Material material = state.getMaterial();

    if (world.isAirBlock(pos) == false && material.isSolid())
    {
        return false;
    }

    if (world.provider.doesWaterVaporize() && block == Blocks.FLOWING_WATER)
    {
        float x = pos.getX();
        float y = pos.getY();
        float z = pos.getZ();

        world.playSound(null, x + 0.5F, y + 0.5F, z + 0.5F, SoundEvents.BLOCK_FIRE_EXTINGUISH,
                SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);

        for (int l = 0; l < 8; ++l)
        {
            world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, x + Math.random(), y + Math.random(), z + Math.random(), 0.0D, 0.0D, 0.0D);
        }
    }
    else
    {
        if (world.isRemote == false && material.isSolid() == false && material.isLiquid() == false)
        {
            // Set a replaceable block to air, and drop the items
            world.destroyBlock(pos, true);
        }

        world.setBlockState(pos, block.getDefaultState(), 3);
        SoundEvent soundevent = block == Blocks.FLOWING_LAVA ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
        world.playSound(null, pos, soundevent, SoundCategory.BLOCKS, 1.0f, 1.0f);
    }

    return true;
}