├── README.md ├── assets ├── arm.blend ├── arm.blend1 ├── skybox.png ├── arm_texture.png ├── arm_texture.psd ├── brick_block.png ├── dirt_block.png ├── grass_block.png ├── punch_sound.wav ├── stone_block.png ├── Grass_block.blend ├── block_textures.psd ├── arm.mtl ├── block.mtl ├── block.obj ├── arm.obj └── punch.xmp └── pycraft.py /README.md: -------------------------------------------------------------------------------- 1 | # pycraft 2 | 3 | made with python and ursina game engine 4 | -------------------------------------------------------------------------------- /assets/arm.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/arm.blend -------------------------------------------------------------------------------- /assets/arm.blend1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/arm.blend1 -------------------------------------------------------------------------------- /assets/skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/skybox.png -------------------------------------------------------------------------------- /assets/arm_texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/arm_texture.png -------------------------------------------------------------------------------- /assets/arm_texture.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/arm_texture.psd -------------------------------------------------------------------------------- /assets/brick_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/brick_block.png -------------------------------------------------------------------------------- /assets/dirt_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/dirt_block.png -------------------------------------------------------------------------------- /assets/grass_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/grass_block.png -------------------------------------------------------------------------------- /assets/punch_sound.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/punch_sound.wav -------------------------------------------------------------------------------- /assets/stone_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/stone_block.png -------------------------------------------------------------------------------- /assets/Grass_block.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/Grass_block.blend -------------------------------------------------------------------------------- /assets/block_textures.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BilalAlpaslan/pycraft/HEAD/assets/block_textures.psd -------------------------------------------------------------------------------- /assets/arm.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'arm.blend' 2 | # Material Count: 1 3 | 4 | newmtl Arm 5 | Ns 0.297520 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.315152 0.315152 0.315152 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | map_Kd arm.png 14 | -------------------------------------------------------------------------------- /assets/block.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl Stone 5 | Ns 225.000000 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | map_Kd grass_block.png 14 | -------------------------------------------------------------------------------- /assets/block.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.81 (sub 16) OBJ File: '' 2 | # www.blender.org 3 | mtllib block.mtl 4 | o Cube 5 | v -1.000000 -1.000000 1.000000 6 | v -1.000000 1.000000 1.000000 7 | v -1.000000 -1.000000 -1.000000 8 | v -1.000000 1.000000 -1.000000 9 | v 1.000000 -1.000000 1.000000 10 | v 1.000000 1.000000 1.000000 11 | v 1.000000 -1.000000 -1.000000 12 | v 1.000000 1.000000 -1.000000 13 | vt 0.375000 0.000000 14 | vt 0.625000 0.000000 15 | vt 0.625000 0.250000 16 | vt 0.375000 0.250000 17 | vt 0.625000 0.500000 18 | vt 0.375000 0.500000 19 | vt 0.625000 0.750000 20 | vt 0.375000 0.750000 21 | vt 0.625000 1.000000 22 | vt 0.375000 1.000000 23 | vt 0.125000 0.500000 24 | vt 0.125000 0.750000 25 | vt 0.875000 0.500000 26 | vt 0.875000 0.750000 27 | vn -1.0000 0.0000 0.0000 28 | vn 0.0000 0.0000 -1.0000 29 | vn 1.0000 0.0000 0.0000 30 | vn 0.0000 0.0000 1.0000 31 | vn 0.0000 -1.0000 0.0000 32 | vn 0.0000 1.0000 0.0000 33 | usemtl Stone 34 | s off 35 | f 1/1/1 2/2/1 4/3/1 3/4/1 36 | f 3/4/2 4/3/2 8/5/2 7/6/2 37 | f 7/6/3 8/5/3 6/7/3 5/8/3 38 | f 5/8/4 6/7/4 2/9/4 1/10/4 39 | f 3/11/5 7/6/5 5/8/5 1/12/5 40 | f 8/5/6 4/13/6 2/14/6 6/7/6 41 | -------------------------------------------------------------------------------- /assets/arm.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.83.0 OBJ File: 'arm.blend' 2 | # www.blender.org 3 | mtllib arm.mtl 4 | o Cube_Cube.001 5 | v 0.000000 -0.500000 0.000000 6 | v 0.000000 0.500000 0.000000 7 | v 0.000000 -0.500000 -3.000000 8 | v 0.000000 0.500000 -3.000000 9 | v 1.000000 -0.500000 0.000000 10 | v 1.000000 0.500000 0.000000 11 | v 1.000000 -0.500000 -3.000000 12 | v 1.000000 0.500000 -3.000000 13 | vt 0.930330 0.500000 14 | vt 0.930330 0.622951 15 | vt 0.561476 0.622951 16 | vt 0.561476 0.500000 17 | vt 0.438524 0.622951 18 | vt 0.438524 0.500000 19 | vt 0.069670 0.622951 20 | vt 0.069670 0.500000 21 | vt 0.438524 0.131146 22 | vt 0.438524 0.008194 23 | vt 0.561476 0.008194 24 | vt 0.561476 0.131146 25 | vt 0.561476 0.991806 26 | vt 0.438524 0.991806 27 | vn -1.0000 0.0000 0.0000 28 | vn 0.0000 0.0000 -1.0000 29 | vn 1.0000 0.0000 0.0000 30 | vn 0.0000 0.0000 1.0000 31 | vn 0.0000 -1.0000 0.0000 32 | vn 0.0000 1.0000 0.0000 33 | usemtl Arm 34 | s off 35 | f 1/1/1 2/2/1 4/3/1 3/4/1 36 | f 3/4/2 4/3/2 8/5/2 7/6/2 37 | f 7/6/3 8/5/3 6/7/3 5/8/3 38 | f 5/9/4 6/10/4 2/11/4 1/12/4 39 | f 3/4/5 7/6/5 5/9/5 1/12/5 40 | f 8/5/6 4/3/6 2/13/6 6/14/6 41 | -------------------------------------------------------------------------------- /pycraft.py: -------------------------------------------------------------------------------- 1 | ########################## Minecraft: Python Editon (pycraft) ########################## 2 | import os 3 | try: 4 | from ursina import * 5 | from ursina.prefabs.first_person_controller import FirstPersonController 6 | except: 7 | os.system('pip install ursina') 8 | 9 | app = Ursina() 10 | 11 | grass_texture = load_texture('assets/grass_block.png') 12 | stone_texture = load_texture('assets/stone_block.png') 13 | brick_texture = load_texture('assets/brick_block.png') 14 | dirt_texture = load_texture('assets/dirt_block.png') 15 | sky_texture = load_texture('assets/skybox.png') 16 | arm_texture = load_texture('assets/arm_texture.png') 17 | roo_texture = load_texture('assets/roo_texture.png') 18 | house_texture = load_texture('assets/house_texture.png') 19 | 20 | punch_sound = Audio('assets/punch_sound',loop = False, autoplay = False) 21 | 22 | # window.fps_counter.enabled = False 23 | window.exit_button.visible = False 24 | 25 | sayı=1 26 | 27 | def update(): 28 | global sayı 29 | 30 | if held_keys['left mouse'] or held_keys['right mouse']:hand.active() 31 | else:hand.passive() 32 | 33 | if held_keys['1']:sayı=1 34 | if held_keys['2']:sayı=2 35 | if held_keys['3']:sayı=3 36 | if held_keys['4']:sayı=4 37 | if held_keys['5']:sayı=5 38 | if held_keys['6']:sayı=6 39 | if held_keys['7']:sayı=7 40 | 41 | 42 | class Voxel(Button): 43 | def __init__(self, position = (0,0,0),voxelColor = color.white, Texture = grass_texture): 44 | super().__init__( 45 | parent= scene, 46 | position = position, 47 | model = 'assets/block', 48 | origin_y = 0.5, 49 | texture = Texture, 50 | color = voxelColor, 51 | scale = 0.5 52 | ) 53 | 54 | def input(self,key): 55 | if self.hovered: 56 | if key == "left mouse down": 57 | punch_sound.play() 58 | if sayı == 1: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= grass_texture) 59 | if sayı == 2: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= stone_texture) 60 | if sayı == 3: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= brick_texture) 61 | if sayı == 4: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= dirt_texture) 62 | if sayı == 5: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= sky_texture) 63 | if sayı == 6: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.white, Texture= arm_texture) 64 | if sayı == 7: voxel = Voxel(position = self.position + mouse.normal, voxelColor = color.orange, Texture= brick_texture) 65 | if key == "right mouse down": 66 | punch_sound.play() 67 | destroy(self) 68 | 69 | class Küre(Button): 70 | def __init__(self, position = (0,0,0), voxelColor = color.white): 71 | super().__init__( 72 | parent = scene, 73 | position = position, 74 | model = "sphere", 75 | origin_y = 0.5, 76 | texture = "white_sphere", 77 | color = voxelColor, 78 | scale = 1 79 | ) 80 | def input(self,key): 81 | if self.hovered: 82 | if key == "left mouse down": 83 | punch_sound.play() 84 | if sayı == 1: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.red) 85 | if sayı == 2: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.blue) 86 | if sayı == 3: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.yellow) 87 | if sayı == 4: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.green) 88 | if sayı == 5: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.black) 89 | if sayı == 6: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.white) 90 | if sayı == 7: voxel = Küre(position = self.position + mouse.normal, voxelColor = color.pink) 91 | if key == "right mouse down": 92 | punch_sound.play() 93 | destroy(self) 94 | 95 | class Sky(Entity): 96 | def __init__(self): 97 | super().__init__( 98 | parent = scene, 99 | model = 'sphere', 100 | texture = sky_texture, 101 | scale = 150, 102 | double_sided = True) 103 | 104 | class Player(FirstPersonController): 105 | def __init__(self , position=(10,5,10)): 106 | super().__init__( 107 | position=position 108 | ) 109 | 110 | 111 | 112 | class Hand(Entity): 113 | def __init__(self): 114 | super().__init__( 115 | parent = camera.ui, 116 | model = 'assets/arm', 117 | texture = arm_texture, 118 | scale = 0.2, 119 | rotation = Vec3(150,-10,0), 120 | position = Vec2(0.4,-0.6)) 121 | 122 | def active(self): 123 | self.position = Vec2(0.3,-0.5) 124 | 125 | def passive(self): 126 | self.position = Vec2(0.4,-0.6) 127 | 128 | 129 | for z in range(30): 130 | for x in range(30): 131 | for y in range(4): 132 | voxel = Voxel(position = (x,y,z), voxelColor=color.color(0,0,random.uniform(0.9,1))) 133 | küre = Küre(position=(5,5,5),voxelColor=color.red) 134 | 135 | player = Player() 136 | sky = Sky() 137 | hand = Hand() 138 | 139 | app.run() -------------------------------------------------------------------------------- /assets/punch.xmp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | CuePoint Markers 15 | Cue 16 | f44100 17 | 18 | 19 | CD Track Markers 20 | Track 21 | f44100 22 | 23 | 24 | Subclip Markers 25 | InOut 26 | f44100 27 | 28 | 29 | 30 | 2020-11-30T21:02:06Z 31 | 2020-11-30T21:02:06Z 32 | xmp.iid:d014fa67-e7e1-154a-b2d4-79210a0240b4 33 | xmp.did:d014fa67-e7e1-154a-b2d4-79210a0240b4 34 | xmp.did:2825da43-b730-0a47-9090-961c6d284b13 35 | 36 | 37 | 38 | saved 39 | xmp.iid:2825da43-b730-0a47-9090-961c6d284b13 40 | 2020-11-30T21:02:06Z 41 | Adobe Audition 13.0 (Windows) 42 | /metadata 43 | 44 | 45 | saved 46 | xmp.iid:d014fa67-e7e1-154a-b2d4-79210a0240b4 47 | 2020-11-30T21:02:06Z 48 | Adobe Audition 13.0 (Windows) 49 | / 50 | 51 | 52 | 53 | 54 | xmp.iid:2825da43-b730-0a47-9090-961c6d284b13 55 | xmp.did:2825da43-b730-0a47-9090-961c6d284b13 56 | xmp.did:2825da43-b730-0a47-9090-961c6d284b13 57 | 58 | audio/ogg; codec="vorbis" 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | --------------------------------------------------------------------------------