Learn R Programming

⚠️There's a newer version (0.2.2) of this package.Take me there.

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. See the vignette for details on setting up a Minecraft server and using this package.

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 extra_vignettes folder for details.) For example, with these functions you could:

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:

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.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Karl W Broman

Last Published

March 24th, 2019

Functions in miner (0.1.2)

getHeading

Get player heading
getHeight

Get height of the world at a given position
setHeading

Set player heading
setPlayerPos

Change player position
getBlocks

Determine block types in a cuboid
getChatPosts

Pull the most recent chat message
lookForward

Check the block type (if any) ahead of the player
mc_close

Close cached connection to Minecraft server
turnLeft

Rotate the player heading to the left
chatPost

Post to chat
find_item

Find item by name or ID/style
mc_connect

Create a connection to a Minecraft server
mc_connection

Return cached connection
setBlock

Place a block
setBlocks

Place blocks in a cuboid
mc_items

Minecraft item information
mc_maze

Generates a maze in front of a player
mc_mazer

Poll the chat window for maze generator commands and spawn mazes right in front of the player
mcsplit

Helper function to split string into data.frame
getPlayerDirection

Get player direction as unit vector
getPlayerIds

Get player IDs
getPlayerPitch

Get player pitch
getPlayerPos

Get player position
getBlock

Determine block type and style at some position
getBlockHits

Get most recent block hits
getPlayerRotation

Get player rotation
initHeading

Set player heading to match the direction the player is facing
mcsplit_message

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

Move the player in the direction of the player heading