PiCraft.Block — Type
`Block`

A minecraft block consisting of an id and data. id is the main identifier and data defines an additional attribute like color or sub-type. Both fields are stored as Int.

source
PiCraft.turtle — Type
turtle

A graphics turtle meant to move in all 3-Dimensions. It contains the following fields:

  • pos : The coordinates of the turtle.
  • direction : The Roll Axis - direction in which the turtle is facing.
  • normal : The Yaw axis - direction normal to the turtle's body.
  • penBlock : The block which will be used to draw.
  • stepSize : The size of a turtle's step.
  • penDown : Activation state of penBlock.

The default constructor initializes the turtle at the player's position,roll axis is the positive x-direction, with the yaw axis pointing downwards. penBlock is gold by default and is activated with the stepSize = 0.5

source
PiCraft.buildModel — Method
buildModel(m::Array{Block, 3}, pos::Tuple{Real, Real, Real})

Build a model from a 3-D block array at pos.

source
PiCraft.connectToWorld — Function
connectToWorld(address = "localhost", port = 4711)

Connect to the Minecraft API. Connects using TCPSocket.

source
PiCraft.copyModel — Method
copyModel(p1::Tuple{Real, Real, Real}, p2::Tuple{Real, Real, Real})

Copy the Blocks between the diagonally opposite blocks and store in a 3-D Block Array.

source
PiCraft.cutModel — Function
cutModel(p1::Tuple{Real, Real, Real}, p2::Tuple{Real, Real, Real}, block::Block)

Copy blocks between diagonally opposite blocks and fill the space with block.

source
PiCraft.drawLine — Function
drawLine(p1::Tuple{Real,Real,Real}, p2::Tuple{Real,Real,Real}, block::PiCraft.Block = PiCraft.GOLD_BLOCK, width::Real = 1)

Draw a line from point p1 to point p2 using block. block is gold block by default.

source
PiCraft.flip — Method
flip(A::Array{Block, 3}, dim::Symbol)

Flip a 3-D Block Array in a particular dimension. Dimensions are x, y and z

Example

julia> A = reshape(Block.(collect(1:8)), (2,2,2))
2×2×2 Array{PiCraft.Block,3}:
[:, :, 1] =
 PiCraft.Block(1, 0)  PiCraft.Block(3, 0)
 PiCraft.Block(2, 0)  PiCraft.Block(4, 0)

[:, :, 2] =
 PiCraft.Block(5, 0)  PiCraft.Block(7, 0)
 PiCraft.Block(6, 0)  PiCraft.Block(8, 0)

julia> flip(A, :z)
2×2×2 Array{PiCraft.Block,3}:
[:, :, 1] =
 PiCraft.Block(5, 0)  PiCraft.Block(7, 0)
 PiCraft.Block(6, 0)  PiCraft.Block(8, 0)

[:, :, 2] =
 PiCraft.Block(1, 0)  PiCraft.Block(3, 0)
 PiCraft.Block(2, 0)  PiCraft.Block(4, 0)
source
PiCraft.getBlock — Method
getBlock(pos::Tuple{Real, Real, Real})

Get the Block information from the specified coordinates.

source
PiCraft.getHeight — Method
getHeight(x::Int, z::Int)

Get the height of the world at the specified x and z coordinates.

source
PiCraft.importSchematic — Method
importSchematic(filename::AbstractString)

Reads a .schematic file and return a 3 - D matrix of type Array{Block, 3}(model) which represents the schematic.

source
PiCraft.mc_send — Function
mc_send(cmd::String, output=true)

Communicate with the Minecraft API. cmd is the command which will be sent to the world with the associated TCPSocket and output indicates whether a response is expected. If true then the respose is returned.

source
PiCraft.parseNBT — Function
parseNBT(filename::AbstractString, ostream::IO = stdout)

Parse a Named Binary tag file.

source
PiCraft.pollBlockHits — Method
pollBlockHits()

Returns an array of all the events which have occurred since the last time the function was called.Each event is described with a tuple ((x, y, z), face, entityId). x, y and z are the coordinates of the block.face is the block's face number which was hit and entityId identifies the player who hit the block using a sword. Polling hit events removes them from the buffer.

source
PiCraft.readTAG — Function
readTag(stream::IO, tagId = -1)

Read a single Binary Tag from stream. tagId is the type of nameless Tag tagId is -1 for Named Binary Tag.

source
PiCraft.rotate — Method
rotate(A::Array{Block, 3}; dir::Symbol = :l, dim::Symbol = :x)

Rotate a 3-D Block Array 90 degrees in a dimension and direction. Dimensions are x, y and z. Directions are l & r.

Example

julia> A = reshape(Block.(collect(1:8)), (2,2,2))
2×2×2 Array{PiCraft.Block,3}:
[:, :, 1] =
 PiCraft.Block(1, 0)  PiCraft.Block(3, 0)
 PiCraft.Block(2, 0)  PiCraft.Block(4, 0)

[:, :, 2] =
 PiCraft.Block(5, 0)  PiCraft.Block(7, 0)
 PiCraft.Block(6, 0)  PiCraft.Block(8, 0)

julia> rotate(A, dir = :r, dim = :y)
 2×2×2 Array{PiCraft.Block,3}:
 [:, :, 1] =
  PiCraft.Block(3, 0)  PiCraft.Block(7, 0)
  PiCraft.Block(4, 0)  PiCraft.Block(8, 0)

 [:, :, 2] =
  PiCraft.Block(1, 0)  PiCraft.Block(5, 0)
  PiCraft.Block(2, 0)  PiCraft.Block(6, 0)
source
PiCraft.setBlock — Method
setBlock(pos::Tuple{Real, Real, Real}, block::Block)

Place the specified Block at the given coordinates.

source
PiCraft.setBlocks — Method
setBlocks(p1::Tuple{Real, Real, Real}, p2::Tuple{Real, Real, Real}, block::Block)

Set an entire region to the specified block type defined by the corners p1 and p2.

source
PiCraft.setPos — Method
setPos(entityId::Int, pos::Tuple{Real, Real, Real})

Set the position of the specified entity.

source
PiCraft.setPos — Method
setPos(pos::Tuple{Real, Real, Real})

Teleport the player to the specified coordinates

source
PiCraft.setTile — Method
setTile(pos::Tuple{Real, Real, Real})

Teleport the player on top of the specified tile

source