Skip to content

Getting started with API

Timaaos edited this page Feb 8, 2021 · 9 revisions

In this tutorial you will make default Craft.py file! Lets start from importing:

import api as mc
import pyglet

Now we need to create object of our window:

window = mc.Window(width=800, height=600, caption='CraftPy', resizable=True)

To change window name, you need to change caption, for example:

caption='MY FIRST MINECRAFT'

Now we need to create our player:

model = mc.Model()

Now we need to init our player:

model._initialize()

Now we need to set our player in window object:

window.model = model

Now we need to setup object:

mc.setup()

Now we need to run our app:

pyglet.app.run()

You done! Try your own minecraft! In next tutorial you will change generator variables!

Full code:

import api as mc
import pyglet
window = mc.Window(width=800, height=600, caption='CraftPy', resizable=True)
model = mc.Model()
model._initialize()
window.model = model
mc.setup()
pyglet.app.run()
Clone this wiki locally