-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started with API
Timaaos edited this page Feb 9, 2021
·
9 revisions
In this tutorial you will make default Craft.py file!
Lets start from creating texture.png, icon.png, break.mp3,place.mp3 files in our mod directory
We need import packages that we need:
import api as mc
import pyglet
import sys,os
Now we need to get our textures:
pathname = os.path.dirname(sys.argv[0])
texture = pathname + "\texture.png"
And we need to set our texture path:
mc.TEXTURE_PATH = texture
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
import sys,os
pathname = os.path.dirname(sys.argv[0])
texture = pathname + "\texture.png"
mc.TEXTURE_PATH = texture
window = mc.Window(width=800, height=600, caption='CraftPy', resizable=True)
model = mc.Model()
model._initialize()
window.model = model
mc.setup()
pyglet.app.run()