Search in sources :

Example 1 with BlockFlower

use of net.minecraft.block.BlockFlower in project ArsMagica2 by Mithion.

the class Ignition method applyEffectBlock.

@Override
public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster) {
    switch(blockFace) {
        case 5:
            blockx++;
            break;
        case 2:
            blockz--;
            break;
        case 3:
            blockz++;
            break;
        case 4:
            blockx--;
            break;
    }
    Block block = world.getBlock(blockx, blocky, blockz);
    if (world.isAirBlock(blockx, blocky, blockz) || block == Blocks.snow || block instanceof BlockFlower) {
        if (!world.isRemote)
            world.setBlock(blockx, blocky, blockz, Blocks.fire);
        return true;
    } else {
        blocky++;
        block = world.getBlock(blockx, blocky, blockz);
        if (world.isAirBlock(blockx, blocky, blockz) || block == Blocks.snow || block instanceof BlockFlower) {
            if (!world.isRemote)
                world.setBlock(blockx, blocky, blockz, Blocks.fire);
            return true;
        }
    }
    return false;
}
Also used : Block(net.minecraft.block.Block) BlockFlower(net.minecraft.block.BlockFlower)

Example 2 with BlockFlower

use of net.minecraft.block.BlockFlower in project ArsMagica2 by Mithion.

the class CreateWater method applyEffectBlock.

@Override
public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster) {
    Block block = world.getBlock(blockx, blocky, blockz);
    if (block == Blocks.cauldron) {
        world.setBlockMetadataWithNotify(blockx, blocky, blockz, 3, 2);
        world.notifyBlockChange(blockx, blocky, blockz, block);
        return true;
    }
    switch(blockFace) {
        case 5:
            blockx++;
            break;
        case 2:
            blockz--;
            break;
        case 3:
            blockz++;
            break;
        case 4:
            blockx--;
            break;
        case 0:
            blocky--;
            break;
        case 1:
            blocky++;
            break;
    }
    block = world.getBlock(blockx, blocky, blockz);
    if (world.isAirBlock(blockx, blocky, blockz) || block == Blocks.snow || block == Blocks.water || block == Blocks.flowing_water || block instanceof BlockFlower) {
        world.setBlock(blockx, blocky, blockz, Blocks.water);
        Blocks.water.onNeighborBlockChange(world, blockx, blocky, blockz, Blocks.air);
        return true;
    }
    return false;
}
Also used : Block(net.minecraft.block.Block) BlockFlower(net.minecraft.block.BlockFlower)

Example 3 with BlockFlower

use of net.minecraft.block.BlockFlower in project NewHorizonsCoreMod by GTNewHorizons.

the class OilGeneratorFix method getTopBlock.

private int getTopBlock(World pWorld, int pLocX, int pLocZ) {
    Chunk tChunk = pWorld.getChunkFromBlockCoords(pLocX, pLocZ);
    int y = tChunk.getTopFilledSegment() + 15;
    int trimmedX = pLocX & 0xF;
    int trimmedZ = pLocZ & 0xF;
    for (; y > 0; y--) {
        Block tBlock = tChunk.getBlock(trimmedX, y, trimmedZ);
        if (!tBlock.isAir(pWorld, pLocX, y, pLocZ)) {
            if ((tBlock instanceof BlockStaticLiquid)) {
                return y;
            }
            if ((tBlock instanceof BlockFluidBase)) {
                return y;
            }
            if ((tBlock instanceof IFluidBlock)) {
                return y;
            }
            if (tBlock.getMaterial().blocksMovement()) {
                if (!(tBlock instanceof BlockFlower)) {
                    return y - 1;
                }
            }
        }
    }
    return -1;
}
Also used : BlockFluidBase(net.minecraftforge.fluids.BlockFluidBase) BlockStaticLiquid(net.minecraft.block.BlockStaticLiquid) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) Chunk(net.minecraft.world.chunk.Chunk) BlockFlower(net.minecraft.block.BlockFlower)

Aggregations

Block (net.minecraft.block.Block)3 BlockFlower (net.minecraft.block.BlockFlower)3 BlockStaticLiquid (net.minecraft.block.BlockStaticLiquid)1 Chunk (net.minecraft.world.chunk.Chunk)1 BlockFluidBase (net.minecraftforge.fluids.BlockFluidBase)1 IFluidBlock (net.minecraftforge.fluids.IFluidBlock)1