PiCraft.BlockType
`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.turtleType
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.buildModelMethod
buildModel(m::Array{Block, 3}, pos::Tuple{Real, Real, Real})

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

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

Connect to the Minecraft API. Connects using TCPSocket.

source
PiCraft.copyModelMethod
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.cutModelFunction
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.drawLineFunction
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.flipMethod
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.getBlockMethod
getBlock(pos::Tuple{Real, Real, Real})

Get the Block information from the specified coordinates.

source
PiCraft.getHeightMethod
getHeight(x::Int, z::Int)

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

source
PiCraft.importSchematicMethod
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_sendFunction
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.parseNBTFunction
parseNBT(filename::AbstractString, ostream::IO = stdout)

Parse a Named Binary tag file.

source
PiCraft.pollBlockHitsMethod
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.readTAGFunction
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.rotateMethod
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.setBlockMethod
setBlock(pos::Tuple{Real, Real, Real}, block::Block)

Place the specified Block at the given coordinates.

source
PiCraft.setBlocksMethod
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.setPosMethod
setPos(entityId::Int, pos::Tuple{Real, Real, Real})

Set the position of the specified entity.

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

Teleport the player to the specified coordinates

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

Teleport the player on top of the specified tile

source