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

The following examples show how to use net.minecraft.init.Blocks#CAULDRON . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: TofuCraftReload   File: TileEntitySaltFurnace.java    License: MIT License 6 votes vote down vote up
/**
 * gets the water Level of the cauldron above this block
 *
 * @return water level. 0-3, int.
 * If there is no cauldron, returns negative value. -1, -2: must put fire one/two blck above, -3: inflammable
 */
@SuppressWarnings("deprecation")
public int getCauldronStatus() {
    IBlockState stateUp = this.world.getBlockState(this.pos.up());
    if (stateUp.getBlock() == Blocks.CAULDRON)
        return stateUp.getValue(BlockCauldron.LEVEL);
    else {
        Block block = stateUp.getBlock();
        if (block.isAir(stateUp, world, this.getPos().up()) || block == Blocks.FIRE) return -1;
        else if (!block.getMaterial(stateUp).getCanBurn()) return -3;
        else {
            IBlockState state2Up = this.world.getBlockState(this.pos.up(2));
            if (state2Up.getBlock().isAir(state2Up, world, this.pos.up(2))) return -2;
            else return -3;
        }
    }
}
 
Example 2
Source Project: TofuCraftReload   File: TileEntitySaltFurnace.java    License: MIT License 5 votes vote down vote up
private void updateCauldronStatus() {
    int stat = this.getCauldronStatus();

    if (this.lastCauldronStatus != stat && this.world.getBlockState(this.pos.up()).getBlock() == Blocks.CAULDRON) {
        int metadata = this.world.getBlockState(this.pos.up()).getValue(BlockCauldron.LEVEL);
        IBlockState newMetadata = Blocks.CAULDRON.getDefaultState().withProperty(BlockCauldron.LEVEL, metadata);
        this.world.setBlockState(this.pos.up(), newMetadata, 2);
        this.lastCauldronStatus = stat;
    }
}