Popularity
4.4
Declining
Activity
0.0
Stable
3
4
2

Monthly Downloads: 18
Programming language: Haskell
License: LicenseRef-PublicDomain
Tags: Network     Minecraft     Raspberrypi    
Latest version: v0.0.1.2

mcpi alternatives and similar packages

Based on the "Network" category.
Alternatively, view mcpi alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of mcpi or a related project?

Add another 'Network' Package

README

mcpi

All code is placed in the Public Domain.

Author

Doug Burke, [email protected]

Description

This is a basic interface to the MineCraft-Pi API. The intention is to build higher-level commands (and add support for missing commands), but you can say

{-# LANGUAGE RecordWildCards #-}

module Main where

import Control.Monad (when)

import Data.MineCraft.Pi.Block 
import Data.MineCraft.Pi.Player
import Data.MineCraft.Pi.Types

import Network.MineCraft.Pi.Client

-- | Returns @True@ if the player is standing on gold ore.
isOnGold :: IO Bool
isOnGold = runMCPI $ do
    Pos {..} <- getPlayerTile
    bType <- getBlock $ Pos _x _y (_z-1)
    return (bType == goldOre)

main :: IO ()
main = do
    flag <- isOnGold
    when flag $ putStrLn "Look down!"

Building

  • Install ghc and the Haskell platform

    sudo apt-get install ghc haskell-platform
    
  • Download the package

    cabal unpack mcpi
    

which will create the directory mcpi-<version>. If you instead say

    cabal install mcpi

then the package will be built and installed into the system; by using unpack you just build a local copy.

  • Build the package

    cd mcpi-<version>
    cabal configure
    cabal build
    

You may need to install the pipes package before the above will run:

    cabal install pipes
  • Run one of the examples

    ./dist/build/isongold/isongold 
    

Examples

Several examples are included in the examples/ directory. They are built, and installed, by default. To avoid building them tun off the build-examples flag at configure time by saying

cabal configure -f-build-examples