Giter Site home page Giter Site logo

pycraft's Introduction

https://travis-ci.org/seventh/PyCraft.svg?branch=master

PyCraft

PyCraft is a high-quality Python library for offline edition of Minecraft worlds. High-quality, because it respects the spirit of the Python programming language (i.e. it is pythonic), and because it also takes care of memory consumption, which can be a huge problem during Minecraft world edition. PyCraft complies with Python 3.3 specifications.

PyCraft is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free software.

Quick and dirty: edit a NBT-formatted file

Here is an example of modifications that can be operated with PyCraft on a file stored with NBT encoding format. NBT encoding is widely used in Minecraft.

from pycraft import nbt

# Load our favorite TAG_COMPOUND
W = nbt.load("entry.nbt")

# Add some meaningful information :)
W[u"author"] = u"Me, myself and I"
W[u"date"] = u"2014-02-26"

# By default, ints are of kind TAG_LONG. Nobody likes show-offs
W[u"nb_of_followers"] = 42
W.set_kind(u"nb_of_followers", con.TAG_BYTE)

# Save it back
nbt.save("entry.nbt", W)

Nota: The Python 2 u"" notation for unicode litteral constants, which had been removed by first releases of Python 3, had been added back by Python 3.3, in order to ease portability between the two Python flavours. Actually, using this notation is mandatory only for Python 2 users, to distinguish unicode strings from byte buffers.

Known limitations of using PyCraft with a Python 2.7 interpreter

The current section lists the packages of PyCraft that are known to be incompatible of a Python 2.7 interpretation:

  • Not a single one.

pycraft's People

Contributors

seventh avatar

Stargazers

 avatar

Watchers

 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.