use of net.minecraft.block.BlockWallSign in project Railcraft by Railcraft.
the class PostConnectionHelper method connect.
public static ConnectStyle connect(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
try {
Block block = state.getBlock();
if (block instanceof IPostConnection && ((IPostConnection) block).connectsToPost(world, pos, state, side) == ConnectStyle.NONE)
return ConnectStyle.NONE;
} catch (Error error) {
Game.logErrorAPI(Railcraft.NAME, error, IPostConnection.class);
return ConnectStyle.NONE;
}
BlockPos otherPos = pos.offset(side);
if (world.isAirBlock(otherPos))
return ConnectStyle.NONE;
IBlockState otherState = WorldPlugin.getBlockState(world, otherPos);
Block otherBlock = otherState.getBlock();
EnumFacing oppositeSide = side.getOpposite();
try {
if (otherBlock instanceof IPostConnection)
return ((IPostConnection) otherBlock).connectsToPost(world, otherPos, otherState, oppositeSide);
} catch (Error error) {
Game.logErrorAPI(Railcraft.NAME, error, IPostConnection.class);
}
if (otherBlock instanceof BlockPostBase)
return ConnectStyle.TWO_THIN;
if (noConnect.contains(otherBlock))
return ConnectStyle.NONE;
if (canConnect.contains(otherBlock))
return ConnectStyle.TWO_THIN;
if (otherBlock instanceof BlockWallSign) {
return otherState.getValue(BlockWallSign.FACING) == side ? ConnectStyle.SINGLE_THICK : ConnectStyle.NONE;
}
if (otherBlock instanceof BlockLantern)
return ConnectStyle.SINGLE_THICK;
if (world.isSideSolid(pos, oppositeSide, false))
return ConnectStyle.TWO_THIN;
return ConnectStyle.NONE;
}
Aggregations