Coder Social home page Coder Social logo

kristofferc / picraft.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juliaberry/picraft.jl

0.0 2.0 0.0 26.56 MB

Manipulate Minecraft on the Raspberry Pi from Julia

Home Page: https://juliaberry.github.io/PiCraft.jl/

License: Other

Julia 100.00%

picraft.jl's Introduction

PiCraft

PiCraft

Control a Minecraft world on the Minecraft: Pi or Java edition from Julia

PiCraft is a Julia package which allows control over the Minecraft World using code. It is compatible with the Minecraft: Pi Edition and the Java Edition with the help of RaspberryJamMod or RaspberryJuice.

With this package you will be able to :

  • Write scripts to teleport and walk over Water and Lava.
  • Construct multi-storey skyscrapers within seconds.
  • Draw fractals and shapes using a 3-D turtle.
  • Import and export .schematic models without external software.

The above examples and more is in the documentation which can be accessed here.

Installation and Usage

Get Minecraft

  • The Minecraft: Pi edition is pre-installed on all Rasbian since September 2014. Launch it by navigating to Menu > Games or typing minecraft-pi in the terminal. However, if you are running an older version of Raspbian get it here.
  • Get the Minecraft: Java edition(MacOS, Linux and Windows) here.

Get RaspberryJuice or RaspberryJamMod (for Minecraft: Java edition)

Officially the ability to communicate with the Minecraft world is only available for the Minecraft: Pi edition. To get this to work on the Java edition we need to install a Mod.

  • "RaspberryJamMod" is a Forge Mod, if you wish to use this along with other Forge mods then this is recommended. Installation instructions are available here.
  • "RaspberryJuice" is a Bukkit server plugin, recommended if you wish to work on a Bukkit Minecraft server. Get it here.

Get Julia

Download the appropriate Julia version for your system from here. If you are on a raspberry pi you should follow the instructions given in the documentation here.

Install the PiCraft package

using Pkg
Pkg.add("https://github.com/JuliaBerry/PiCraft.jl")

Documentation

Documentation for this package can be accessed at https://juliaberry.github.io/PiCraft.jl/ The documentation consists of a setup instructions, basic tutorials, examples and reference pages.

Quick Start Guide

Load the PiCraft package on the Julia console:

using PiCraft

On load, the library will attempt to connect to a running Minecraft world on localhost. If Minecraft is not running, an error message will be printed. Subsequently, once Minecraft has been started, a connection can be forced by calling connectToWorld().

A 3-D coordinate system is used to describe the Minecraft world. Every position in the Minecraft World can be described with the help of 3 numbers. The X, Y and Z coordinates. These coordinates can be viewed by opening the Debug screen pressing the F3 key.

debug-screen

Player

You can find and set your player's location:

  1. Find Player position: getPos()
    • Returns a Tuple{Float64, Float64, Float64} which contains the player's current coordinates.
  2. Set Player position: setPos(pos::Tuple{Float64, Float64, Float64})
    • Teleports the player to the specified coordinates.

For example : setPos(getPos() .+ (0, 10, 0)) will teleport you 10m above you current position.

Blocks

Blocks are the heart of Minecraft. The package provides the ability to modify blocks at specified coordinates. Block is an immutable datatype defined in src/blocks.jl.

struct Block
    id::Int
    data::Int
end

The id defines the type of block (like cobblestone, wool, wood,.etc) and the data attribute defines additional characteristics of the block, on default every block has it data set to 0. For example, Wool's block id is 35, Block(35,0) refers to a block of white wool. Different wool colors can be accessed by changing the data attribute. Red Wool is Block(35, 14), Pink Wool is Block(35,6) and so on. A complete reference can be found here in the documentation.

  1. Place Block: setBlock(Tuple{Int, Int, Int}, block::Block)
    • Place the specified Block at the specified coordinates.
  2. Place Blocks: setBlocks(p1::Tuple{Real, Real, Real}, p2::Tuple{Real, Real, Real}, block::Block)
    • Set an entire region to the specified block type defined by corners.
  3. Get Block information: getBlock(Tuple{Int,Int,Int})
    • Returns the block present at the specified coordinates.

While the getBlock and setBlock functions will accept Float64 as arguments these will be rounded and set to Int as a block cannot be placed on non-integer coordinates.

Contributing

Contributions and bug reports are welcome! If you want to share some of your work, have a query or an example to share you can post on the #PiCraft channel on julialang's slack or open an issue on the PiCraft github page directly.

picraft.jl's People

Contributors

aviks avatar barche avatar ellipse0934 avatar inkydragon avatar staticfloat avatar tkelman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.