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

The following are Jave code examples for showing how to use TRIPWIRE_HOOK 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: Backmemed   File: BlockTripWire.java   View Source Code Vote up 6 votes
private void notifyHook(World worldIn, BlockPos pos, IBlockState state)
{
    for (EnumFacing enumfacing : new EnumFacing[] {EnumFacing.SOUTH, EnumFacing.WEST})
    {
        for (int i = 1; i < 42; ++i)
        {
            BlockPos blockpos = pos.offset(enumfacing, i);
            IBlockState iblockstate = worldIn.getBlockState(blockpos);

            if (iblockstate.getBlock() == Blocks.TRIPWIRE_HOOK)
            {
                if (iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing.getOpposite())
                {
                    Blocks.TRIPWIRE_HOOK.calculateState(worldIn, blockpos, iblockstate, false, true, i, state);
                }

                break;
            }

            if (iblockstate.getBlock() != Blocks.TRIPWIRE)
            {
                break;
            }
        }
    }
}
 
Example 2
Project: Backmemed   File: BlockTripWire.java   View Source Code Vote up 6 votes
public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing direction)
{
    BlockPos blockpos = pos.offset(direction);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block == Blocks.TRIPWIRE_HOOK)
    {
        EnumFacing enumfacing = direction.getOpposite();
        return iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing;
    }
    else
    {
        return block == Blocks.TRIPWIRE;
    }
}
 
Example 3
Project: CustomWorldGen   File: BlockTripWire.java   View Source Code Vote up 6 votes
private void notifyHook(World worldIn, BlockPos pos, IBlockState state)
{
    for (EnumFacing enumfacing : new EnumFacing[] {EnumFacing.SOUTH, EnumFacing.WEST})
    {
        for (int i = 1; i < 42; ++i)
        {
            BlockPos blockpos = pos.offset(enumfacing, i);
            IBlockState iblockstate = worldIn.getBlockState(blockpos);

            if (iblockstate.getBlock() == Blocks.TRIPWIRE_HOOK)
            {
                if (iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing.getOpposite())
                {
                    Blocks.TRIPWIRE_HOOK.calculateState(worldIn, blockpos, iblockstate, false, true, i, state);
                }

                break;
            }

            if (iblockstate.getBlock() != Blocks.TRIPWIRE)
            {
                break;
            }
        }
    }
}
 
Example 4
Project: CustomWorldGen   File: BlockTripWire.java   View Source Code Vote up 6 votes
public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing direction)
{
    BlockPos blockpos = pos.offset(direction);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block == Blocks.TRIPWIRE_HOOK)
    {
        EnumFacing enumfacing = direction.getOpposite();
        return iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing;
    }
    else
    {
        return block == Blocks.TRIPWIRE;
    }
}