Search in sources :

Example 6 with BlockFenceGate

use of net.minecraft.block.BlockFenceGate in project NetherEx by LogicTechCorp.

the class EntityAIUseFenceGate method openFenceGate.

private void openFenceGate(boolean open) {
    World world = theEntity.getEntityWorld();
    IBlockState state = world.getBlockState(fenceGatePos);
    if (state.getBlock() instanceof BlockFenceGate) {
        world.setBlockState(fenceGatePos, state.withProperty(BlockFenceGate.OPEN, open), 10);
        world.markBlockRangeForRenderUpdate(fenceGatePos, fenceGatePos);
        world.playEvent(null, open ? 1008 : 1014, fenceGatePos, 0);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockFenceGate(net.minecraft.block.BlockFenceGate) World(net.minecraft.world.World)

Example 7 with BlockFenceGate

use of net.minecraft.block.BlockFenceGate in project NetherEx by LogicTechCorp.

the class EntityAIFenceGateInteract method getFenceGate.

private BlockFenceGate getFenceGate(BlockPos pos) {
    IBlockState iblockstate = theEntity.world.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block instanceof BlockFenceGate ? (BlockFenceGate) block : null;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockFenceGate(net.minecraft.block.BlockFenceGate) Block(net.minecraft.block.Block)

Aggregations

BlockFenceGate (net.minecraft.block.BlockFenceGate)7 IBlockState (net.minecraft.block.state.IBlockState)7 Block (net.minecraft.block.Block)5 IELadderBlock (blusunrize.immersiveengineering.common.blocks.BlockIEBase.IELadderBlock)2 BlockFence (net.minecraft.block.BlockFence)2 BlockStairs (net.minecraft.block.BlockStairs)1 EnumFacing (net.minecraft.util.EnumFacing)1 World (net.minecraft.world.World)1