Skip to content
Sign upLog in
← Back to Community

UrsaCraft

Profile icon
NVVC008

Hey guys!

@NVVC008
here! My old account got hacked, so I'm using this for now. In this tutorial, I'm gonna be teaching you how to make Minecraft in python. First, you're gonna need to download PyCharm Community Edition. Also, sorry MacOS users, this package is only available on windows. Speaking of which, you need to download ursina with pip install ursina or:

  1. Click on 'File' on the top right corner of the PyCharm window.
  2. Click on 'Settings'...
  3. Click on 'Project: (Project name)' and select python interpreter...
  4. Click Alt + Insert...
  5. Enter the name: ursina...
  6. Download the package, and you're done!
    BTW, download the folder 'Minecraft-in-Python-main' included with the project. Do not download the code file Minecraft.py.
    Let's start with our code in the file main.py.
    I bet you can guess what's coming first.
import ursina

Well, you were close. Instead, it's:

from ursina import *

That's like saying, "Get me some glass bottles from amazon, without the box." Basically, the guy is gonna give you unpackaged bottles.

Next, we're gonna need our first-person controller.

from ursina.prefabs.first_person_controller import FirstPersonController

Then:

app = Ursina()

Basically, we're creating a name/shortcut for the Ursina package.
Now, the textures.

grass_texture = load_texture('assets/grass_block.png') stone_texture = load_texture('assets/stone_block.png') brick_texture = load_texture('assets/brick_block.png') dirt_texture = load_texture('assets/dirt_block.png') sky_texture = load_texture('assets/skybox.png') arm_texture = load_texture('assets/arm_texture.png') punch_sound = Audio('assets/punch_sound',loop = False, autoplay = False) block_pick = 1

So far, your code should be like this:

from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController app = Ursina() grass_texture = load_texture('assets/grass_block.png') stone_texture = load_texture('assets/stone_block.png') brick_texture = load_texture('assets/brick_block.png') dirt_texture = load_texture('assets/dirt_block.png') sky_texture = load_texture('assets/skybox.png') arm_texture = load_texture('assets/arm_texture.png') punch_sound = Audio('assets/punch_sound',loop = False, autoplay = False) block_pick = 1

If you want to exit or see your fps, you can add this:

window.fps_counter.enabled = True window.exit_button.visible = True

Or, you can just set them to false. But, they have to be there.
Now, we need to have our screen constantly update, right? So, add:

def update():

Here, we created the action that will keep updating our screen.
Add:

global block_pick

This converts it into a global variable.
Make sure the definition so far is:

def update(): global block_pick

Let's add the rest of it.

def update(): global block_pick if held_keys['left mouse'] or held_keys['right mouse']: hand.active() else: hand.passive() if held_keys['1']: block_pick = 1 if held_keys['2']: block_pick = 2 if held_keys['3']: block_pick = 3 if held_keys['4']: block_pick = 4

You know what, I don't care anymore. Just take the code and leave.

Voters
Profile icon
jimjamreplit123
Profile icon
SHAWNCARSEY
Profile icon
NVVC008
Comments
hotnewtop
Profile icon
SewnShara

Thanks to your tutorial i already know how to make Minecraft in python. it's very detailed and easy to understand. subway surfers

Profile icon
hamzamaqsood3

Yeah, it does. I was https://www.vlogr.com/ surprised too. Even more surprised when I found out it can do links too. Like a markdown link with custom text. IT DOES THAT.

Profile icon
ArshadSaqib

In the visual inspection process all parts/components are inspected for conformance to their specifications and for any abnormalities. https://patriciarestrepo.org/sin-categoria/11811/

Profile icon
peterkipen

The tutorial is simple and easy to understand.
poppy playtime

Profile icon
David202008

If you don't give up then tomorrow will be a better day, Learn from mistakes when they happen instead of wishing there was a time machine. Sames goes with the one I write my essay and you must take a close look at that.

Profile icon
prageeth675

Noice