Learn R Programming

miner

Following the python module py3minepi, this is an R package that allows connection to the Minecraft API using RaspberryJuice and either Spigot or Minecraft:Pi.

The miner package provides a few simple functions to manipulate the Minecraft world from R. The intent of this package is to encourage new R users to learn R by writing scripts to do fun things in Minecraft.

See the online book, R Programming with Minecraft, for details on setting up a Minecraft server and using this package, and for a variety of detailed examples. The package also contains a short vignette on its basic use.

Here are a few of the things you can do with miner:

Write words on a hillside:

Render a photograph as a wall of blocks:

Or the R logo:

Generate a random maze in R, and create it in the world for players to explore:

This player is operated by a bot trying to find its way out of the maze via a rule-based algorithm:

Give the player the powers of Elsa:

Freeze water as you run over it

or create towers of ice with a gesture:

Write a bot to play a game with players over chat:

.

And, of course, make ggplot plots in Minecraft:

Extending

The craft package includes additional functions that illustrate and extend the use of miner. Contributors who want to extend the functionality of miner should submit a pull request to the craft package.

Documentation

R Programming with Minecraft is a bookdown book about R and Minecraft, and particularly about using Minecraft with the miner package. Contributors who want to add documentation should submit a pull request to the miner_book repository on Github.

About this package

This package was created as part of the ROpenSci unconference in May, 2017 by:

License

Licensed under the MIT license. (More information here.)

Copy Link

Version

Version

0.2.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Karl Broman

Last Published

March 24th, 2019

Functions in miner (0.2.2)

getChatPosts

Pull the most recent chat message
getEntityTypes

Get entity types
getPlayerPos

Get player position
getPlayerRotation

Get player rotation
setPlayerDirection

Set a player's direction
setPlayerPitch

Set a player's pitch
getBlockHits

Get most recent block hits
getBlocks

Determine block types in a cuboid
getPlayerId

Get player ID
spawnEntity

Spawn an entity
getPlayerIds

Get player IDs
find_item

Find item by name or ID/style
chatPost

Post to chat
find_entity

Find entity by name
getHeight

Get height of the world at a given position
getPlayerDirection

Get player direction as unit vector
getBlock

Determine block type and style at some position
getPlayerName

Get player name
mc_close

Close cached connection to Minecraft server
mc_connection

Return cached connection
mc_connect

Create a connection to a Minecraft server
setBlock

Place a block
getPlayerPitch

Get player pitch
mcsplit

Helper function to split string into data.frame
mc_items

Minecraft item information
mcsplit_message

Helper function to split string into data.frame, for the chat
setPlayerPos

Change player position
setBlocks

Place blocks in a cuboid
setPlayerRotation

Set a player's rotation