mcpp (Minecraft++) is a library built to interface with Minecraft through Spigot server running the ELCI plugin and using C++. It is currently limited to MacOS/Linux or Windows with WSL.
This library is based on mcpi, which is a Python library with similar functionality.
In addition to C++ support, this library implements several new commands supported by ELCI:
getBlocksWithDatato get a cuboid of blocks with data in a performant manner,getHeightsto get a 2D area of heights in a performant manner,doCommandto perform an in-game minecraft command which allows for additional functionality.
This C++ version was created for the Royal Melbourne Institute of Technology (RMIT) to supplement the COSC2084 (Programming Studio 2) course.
The release is compiled using g++ and is intended for use with UNIX systems.
Since the release is intended for UNIX systems and not tested on Windows, the options to run locally are as follows:
- Build manually, requiring the Boost library (there are included CMake build files)
- Run with WSL, in which case follow the Linux instructions below. You may need to specify a connection address manually in
MinecraftConnection()if you are running Spigot with ELCI on Windows, which you can find usingnslookup "$(hostname).local"on your WSL terminal. The default port for ELCI is 4711.
- Download the latest release, unzip and run
install_mcpp_lib.sh. - You may need to make it executable using
sudo chmod a+x install_mcpp_lib.shin your terminal. - After doing this, the library should be accessible via a
#include <mcpp/mcpp.h>directive. - When compiling code using the library, use the flag
-lmcppfor Makefiles ortarget_link_librariesfor CMake.
