PiCraft.BlockPiCraft.turtlePiCraft.buildModelPiCraft.clearEventsPiCraft.connectToWorldPiCraft.copyModelPiCraft.cutModelPiCraft.drawLinePiCraft.flipPiCraft.getBlockPiCraft.getHeightPiCraft.getPlayerIdsPiCraft.getPosPiCraft.getPosPiCraft.getTilePiCraft.getTilePiCraft.importSchematicPiCraft.mc_sendPiCraft.movePiCraft.parseNBTPiCraft.pitchPiCraft.pollBlockHitsPiCraft.postPiCraft.readTAGPiCraft.restoreWorldPiCraft.rollPiCraft.rotatePiCraft.saveWorldPiCraft.setBlockPiCraft.setBlocksPiCraft.setPosPiCraft.setPosPiCraft.setTilePiCraft.setTilePiCraft.yaw
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.
PiCraft.turtle — TypeturtleA 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 ofpenBlock.
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
PiCraft.buildModel — MethodbuildModel(m::Array{Block, 3}, pos::Tuple{Real, Real, Real})Build a model from a 3-D block array at pos.
PiCraft.clearEvents — MethodClear all events in the buffer
PiCraft.connectToWorld — FunctionconnectToWorld(address = "localhost", port = 4711)Connect to the Minecraft API. Connects using TCPSocket.
PiCraft.copyModel — MethodcopyModel(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.
PiCraft.cutModel — FunctioncutModel(p1::Tuple{Real, Real, Real}, p2::Tuple{Real, Real, Real}, block::Block)Copy blocks between diagonally opposite blocks and fill the space with block.
PiCraft.drawLine — FunctiondrawLine(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.
PiCraft.flip — Methodflip(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)PiCraft.getBlock — MethodgetBlock(pos::Tuple{Real, Real, Real})Get the Block information from the specified coordinates.
PiCraft.getHeight — MethodgetHeight(x::Int, z::Int)Get the height of the world at the specified x and z coordinates.
PiCraft.getPlayerIds — MethodgetPlayerIds()Return an array of all Player Id's connected to the server.
PiCraft.getPos — MethodgetPos(entityId::Int)Get the position of the specified entity.
PiCraft.getPos — MethodgetPos()Return the player's coordinates.
PiCraft.getTile — MethodgetTile(entityId::Int)Get the tile on which the specified entity is.
PiCraft.getTile — MethodgetTile()Return the tile's coordinates on which the player is standing.
PiCraft.importSchematic — MethodimportSchematic(filename::AbstractString)Reads a .schematic file and return a 3 - D matrix of type Array{Block, 3}(model) which represents the schematic.
PiCraft.mc_send — Functionmc_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.
PiCraft.move — Methodmove(t::turtle, s::Int)Move the turtle t forward s units.
PiCraft.parseNBT — FunctionparseNBT(filename::AbstractString, ostream::IO = stdout)Parse a Named Binary tag file.
PiCraft.pitch — Methodpitch(t::turtle, θ::Real)Pitch the turtle t by θ degrees.
PiCraft.pollBlockHits — MethodpollBlockHits()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.
PiCraft.post — Methodpost(m...)Post a message to chat
PiCraft.readTAG — FunctionreadTag(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.
PiCraft.restoreWorld — MethodRestore the world to the previous savepoint.
PiCraft.roll — Methodroll(t::turtle, θ::Real)Roll the turtle t by θ degrees.
PiCraft.rotate — Methodrotate(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)PiCraft.saveWorld — MethodSave the World's progress
PiCraft.setBlock — MethodsetBlock(pos::Tuple{Real, Real, Real}, block::Block)Place the specified Block at the given coordinates.
PiCraft.setBlocks — MethodsetBlocks(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.
PiCraft.setPos — MethodsetPos(entityId::Int, pos::Tuple{Real, Real, Real})Set the position of the specified entity.
PiCraft.setPos — MethodsetPos(pos::Tuple{Real, Real, Real})Teleport the player to the specified coordinates
PiCraft.setTile — MethodsetTile(entityId::Int)Teleport the entity on the specified tile.
PiCraft.setTile — MethodsetTile(pos::Tuple{Real, Real, Real})Teleport the player on top of the specified tile
PiCraft.yaw — Methodyaw(t::turtle, θ::Real)Yaw the turtle t by θ degrees.