Java Code Examples for net.minecraft.block.Block#func_149730_j()

The following examples show how to use net.minecraft.block.Block#func_149730_j() . 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: BlockPotteryTable.java    From GardenCollection with MIT License 6 votes vote down vote up
private void setBlockDirection (World world, int x, int y, int z) {
    if (!world.isRemote) {
        Block blockZNeg = world.getBlock(x, y, z - 1);
        Block blockZPos = world.getBlock(x, y, z + 1);
        Block blockXNeg = world.getBlock(x - 1, y, z);
        Block blockXPos = world.getBlock(x + 1, y, z);

        byte dir = 3;
        if (blockZNeg.func_149730_j() && !blockZPos.func_149730_j())
            dir = 3;
        if (blockZPos.func_149730_j() && !blockZNeg.func_149730_j())
            dir = 2;
        if (blockXNeg.func_149730_j() && !blockXPos.func_149730_j())
            dir = 5;
        if (blockXPos.func_149730_j() && !blockXNeg.func_149730_j())
            dir = 4;

        world.setBlockMetadataWithNotify(x, y, z, dir, 2);
    }
}
 
Example 2
Source File: BlockBloomeryFurnace.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public void onBlockAdded (World world, int x, int y, int z) {
    super.onBlockAdded(world, x, y, z);

    if (!world.isRemote) {
        Block neighborZN = world.getBlock(x, y, z - 1);
        Block neighborZP = world.getBlock(x, y, z + 1);
        Block neighborXN = world.getBlock(x - 1, y, z);
        Block neighborXP = world.getBlock(x + 1, y, z);
        byte direction = 3;

        if (neighborZP.func_149730_j() && !neighborZN.func_149730_j())
            direction = 3;
        if (neighborZN.func_149730_j() && !neighborZP.func_149730_j())
            direction = 2;
        if (neighborXP.func_149730_j() && !neighborXN.func_149730_j())
            direction = 5;
        if (neighborXN.func_149730_j() && !neighborXP.func_149730_j())
            direction = 4;

        world.setBlockMetadataWithNotify(x, y, z, direction, 2);
    }
}
 
Example 3
Source File: BlockTrap.java    From Artifacts with MIT License 5 votes vote down vote up
/**
 * sets Dispenser block direction so that the front faces an non-opaque block; chooses west to be direction if all
 * surrounding blocks are opaque.
 */
private void setDispenserDefaultDirection(World par1World, int par2, int par3, int par4)
{
    if (!par1World.isRemote)
    {
        Block block = par1World.getBlock(par2, par3, par4 - 1);
        Block block1 = par1World.getBlock(par2, par3, par4 + 1);
        Block block2 = par1World.getBlock(par2 - 1, par3, par4);
        Block block3 = par1World.getBlock(par2 + 1, par3, par4);
        byte b0 = 3;

        if (block.func_149730_j() && !block1.func_149730_j())
        {
            b0 = 3;
        }

        if (block1.func_149730_j() && !block.func_149730_j())
        {
            b0 = 2;
        }

        if (block2.func_149730_j() && !block3.func_149730_j())
        {
            b0 = 5;
        }

        if (block3.func_149730_j() && !block2.func_149730_j())
        {
            b0 = 4;
        }

        par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
    }
}