├── .gitignore ├── .idea ├── .gitignore ├── MinecraftAtHome.iml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml └── modules.xml ├── README.md ├── assets ├── arm.mtl ├── arm.obj ├── arm_texture.png ├── arm_texture.psd └── komaru.mp4 ├── main.py └── textures ├── arm.png ├── dirt.png ├── dirt_podzol_side.png ├── dirt_podzol_top.png ├── dirt_with_roots.png ├── grass_block_snow.png ├── grass_carried.png ├── grass_path_side.png ├── grass_path_top.png ├── grass_side.tga ├── grass_side_carried.png ├── grass_side_snowed.png ├── grass_side_snowed.tga ├── grass_top.png └── gravel.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Python template 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | *.py[cod] 6 | *$py.class 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *,cover 48 | .hypothesis/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | 58 | # Flask stuff: 59 | instance/ 60 | .webassets-cache 61 | 62 | # Scrapy stuff: 63 | .scrapy 64 | 65 | # Sphinx documentation 66 | docs/_build/ 67 | 68 | # PyBuilder 69 | target/ 70 | 71 | # IPython Notebook 72 | .ipynb_checkpoints 73 | 74 | # pyenv 75 | .python-version 76 | 77 | # celery beat schedule file 78 | celerybeat-schedule 79 | 80 | # dotenv 81 | .env 82 | 83 | # virtualenv 84 | venv/ 85 | ENV/ 86 | 87 | # Spyder project settings 88 | .spyderproject 89 | 90 | # Rope project settings 91 | .ropeproject 92 | ### VirtualEnv template 93 | # Virtualenv 94 | # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ 95 | [Bb]in 96 | [Ii]nclude 97 | [Ll]ib 98 | [Ll]ib64 99 | [Ll]ocal 100 | [Ss]cripts 101 | pyvenv.cfg 102 | .venv 103 | pip-selfcheck.json 104 | 105 | ### JetBrains template 106 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 107 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 108 | 109 | # User-specific stuff 110 | .idea/**/workspace.xml 111 | .idea/**/tasks.xml 112 | .idea/**/usage.statistics.xml 113 | .idea/**/dictionaries 114 | .idea/**/shelf 115 | 116 | # AWS User-specific 117 | .idea/**/aws.xml 118 | 119 | # Generated files 120 | .idea/**/contentModel.xml 121 | 122 | # Sensitive or high-churn files 123 | .idea/**/dataSources/ 124 | .idea/**/dataSources.ids 125 | .idea/**/dataSources.local.xml 126 | .idea/**/sqlDataSources.xml 127 | .idea/**/dynamic.xml 128 | .idea/**/uiDesigner.xml 129 | .idea/**/dbnavigator.xml 130 | 131 | # Gradle 132 | .idea/**/gradle.xml 133 | .idea/**/libraries 134 | 135 | # Gradle and Maven with auto-import 136 | # When using Gradle or Maven with auto-import, you should exclude module files, 137 | # since they will be recreated, and may cause churn. Uncomment if using 138 | # auto-import. 139 | # .idea/artifacts 140 | # .idea/compiler.xml 141 | # .idea/jarRepositories.xml 142 | # .idea/modules.xml 143 | # .idea/*.iml 144 | # .idea/modules 145 | # *.iml 146 | # *.ipr 147 | 148 | # CMake 149 | cmake-build-*/ 150 | 151 | # Mongo Explorer plugin 152 | .idea/**/mongoSettings.xml 153 | 154 | # File-based project format 155 | *.iws 156 | 157 | # IntelliJ 158 | out/ 159 | 160 | # mpeltonen/sbt-idea plugin 161 | .idea_modules/ 162 | 163 | # JIRA plugin 164 | atlassian-ide-plugin.xml 165 | 166 | # Cursive Clojure plugin 167 | .idea/replstate.xml 168 | 169 | # SonarLint plugin 170 | .idea/sonarlint/ 171 | 172 | # Crashlytics plugin (for Android Studio and IntelliJ) 173 | com_crashlytics_export_strings.xml 174 | crashlytics.properties 175 | crashlytics-build.properties 176 | fabric.properties 177 | 178 | # Editor-based Rest Client 179 | .idea/httpRequests 180 | 181 | # Android studio 3.1+ serialized cache file 182 | .idea/caches/build_file_checksums.ser 183 | 184 | # idea folder, uncomment if you don't need it 185 | # .idea -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/MinecraftAtHome.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MinecraftAtHome 2 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /assets/arm_texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/assets/arm_texture.png -------------------------------------------------------------------------------- /assets/arm_texture.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/assets/arm_texture.psd -------------------------------------------------------------------------------- /assets/komaru.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/assets/komaru.mp4 -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from ursina import * 2 | from ursina.shaders import lit_with_shadows_shader 3 | from ursina.prefabs.first_person_controller import FirstPersonController 4 | 5 | game = Ursina() 6 | 7 | # textures 8 | textures = { 9 | "grass": { 10 | # "sides": 'textures/grass_side_carried.png', 11 | "sides": 'textures/grass_side_carried.png', 12 | "top": 'textures/grass_carried.png', 13 | "bottom": 'textures/dirt.png' 14 | }, 15 | } 16 | 17 | # shaders config 18 | # lit_with_shadows_shader.default_input['shadow_blur'] = 0 19 | lit_with_shadows_shader.default_input['shadow_color'] = color.rgba(0, 0, 0, 0.1) 20 | game.render.set_depth_offset(0) 21 | 22 | 23 | class MinecraftHand(Entity): 24 | def __init__(self, **kwargs): 25 | super().__init__(**kwargs) 26 | 27 | # Arm base 28 | self.arm = Entity( 29 | parent=self, 30 | model = 'assets/arm', 31 | texture='assets/arm_texture.png', 32 | rotation=Vec3(155, -15, 0), 33 | position=Vec2(0.6, -0.6), 34 | scale=0.2 35 | ) 36 | 37 | # Subtle swaying animation 38 | self.bob_amplitude = 0.005 39 | self.bob_frequency = 4 40 | 41 | def active(self): 42 | self.arm.position = Vec2(0.55, -0.55) 43 | 44 | def passive(self): 45 | self.arm.position = Vec2(0.6, -0.6) 46 | 47 | def update(self): 48 | # Simple bobbing effect when moving 49 | t = time.time() * self.bob_frequency 50 | self.arm.rotation_z += sin(t) * self.bob_amplitude * 10 51 | self.arm.rotation_x += cos(t) * self.bob_amplitude * 5 52 | 53 | if held_keys['left mouse'] or held_keys['right mouse']: 54 | hand.active() 55 | else: 56 | hand.passive() 57 | 58 | 59 | # Grass Block 60 | def create_cube(position=(0, 0, 0), cube_type = "grass"): 61 | # Create parent entity to group cube faces 62 | cube = Entity(parent = scene, origin_y=.5, highlight_color=color.lime, y = 1, scale = 1, collider = "box", shader = lit_with_shadows_shader) 63 | cube.position = position 64 | 65 | if cube_type == "grass": 66 | faces_config = [ 67 | ((0, 0, 0.5), (0, 0, 0), textures["grass"]["sides"]), # Front 68 | ((0, 0, -0.5), (0, 180, 0), textures["grass"]["sides"]), # Back 69 | ((0.5, 0, 0), (0, 90, 0), textures["grass"]["sides"]), # Right 70 | ((-0.5, 0, 0), (0, -90, 0), textures["grass"]["sides"]), # Left 71 | ((0, 0.5, 0), (90, 0, 0), textures["grass"]["top"]), # Top 72 | ((0, -0.5, 0), (-90, 0, 0), textures["grass"]["bottom"]) # Bottom 73 | ] 74 | elif cube_type == "dirt": 75 | faces_config = [ 76 | ((0, 0, 0.5), (0, 0, 0), textures["grass"]["bottom"]), # Front 77 | ((0, 0, -0.5), (0, 180, 0), textures["grass"]["bottom"]), # Back 78 | ((0.5, 0, 0), (0, 90, 0), textures["grass"]["bottom"]), # Right 79 | ((-0.5, 0, 0), (0, -90, 0), textures["grass"]["bottom"]), # Left 80 | ((0, 0.5, 0), (90, 0, 0), textures["grass"]["bottom"]), # Top 81 | ((0, -0.5, 0), (-90, 0, 0), textures["grass"]["bottom"]) # Bottom 82 | ] 83 | 84 | for pos, rot, tex_path in faces_config: 85 | face = Entity( 86 | parent=cube, 87 | model='quad', 88 | texture=tex_path, 89 | position=pos, 90 | rotation=rot, 91 | double_sided=True, # Makes both sides of the quad visible 92 | render_queue=1 # Ensures consistent rendering 93 | ) 94 | 95 | return cube 96 | 97 | # Spawn base cubes 98 | for z in range(10): 99 | for x in range(10): 100 | grass_block = create_cube(position=(x, 0, z), cube_type="grass") 101 | 102 | # grass_cube.animate("rotation_y", grass_cube.rotation_y+360, duration=2, curve=curve.in_out_expo) 103 | 104 | # floor 105 | #Entity(model='plane', texture="grass", scale=10, color=color.gray, shader=lit_with_shadows_shader) 106 | 107 | # свет (направленный) 108 | directional_light_pivot = Entity() 109 | directional_light = DirectionalLight(parent=directional_light_pivot, shadows=True, rotation=(45, -45, 45), shadow_map_resolution = Vec2(8192, 8192)) 110 | directional_light.look_at(Vec3(-1,-1,-0.5)) 111 | AmbientLight(color = color.rgba(100, 100, 100, 0.1), intensity = 0.5) 112 | 113 | # input 114 | def input(key): 115 | if key == 'left mouse down' and mouse.hovered_entity: 116 | if mouse.normal: 117 | new_position = mouse.hovered_entity.position + mouse.normal 118 | create_cube(position=new_position, cube_type="dirt") 119 | 120 | if key == 'right mouse down' and mouse.hovered_entity: 121 | destroy(mouse.hovered_entity) 122 | 123 | if key == 'escape': 124 | quit() 125 | 126 | # player 127 | player = FirstPersonController(y=2, origin_y=-.5) 128 | 129 | # Add Minecraft-style hand 130 | hand = MinecraftHand(parent=camera.ui) 131 | 132 | # BG color 133 | window.color = color.rgb(141,164,205) 134 | 135 | # go go go 136 | game.run() # запускаем будущего конкурента майнкрафту xD -------------------------------------------------------------------------------- /textures/arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/arm.png -------------------------------------------------------------------------------- /textures/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/dirt.png -------------------------------------------------------------------------------- /textures/dirt_podzol_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/dirt_podzol_side.png -------------------------------------------------------------------------------- /textures/dirt_podzol_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/dirt_podzol_top.png -------------------------------------------------------------------------------- /textures/dirt_with_roots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/dirt_with_roots.png -------------------------------------------------------------------------------- /textures/grass_block_snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_block_snow.png -------------------------------------------------------------------------------- /textures/grass_carried.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_carried.png -------------------------------------------------------------------------------- /textures/grass_path_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_path_side.png -------------------------------------------------------------------------------- /textures/grass_path_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_path_top.png -------------------------------------------------------------------------------- /textures/grass_side.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_side.tga -------------------------------------------------------------------------------- /textures/grass_side_carried.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_side_carried.png -------------------------------------------------------------------------------- /textures/grass_side_snowed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_side_snowed.png -------------------------------------------------------------------------------- /textures/grass_side_snowed.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_side_snowed.tga -------------------------------------------------------------------------------- /textures/grass_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/grass_top.png -------------------------------------------------------------------------------- /textures/gravel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Priler/MinecraftAtHome/262b440e225fd17ddb3ca7194dc004fb694f32e0/textures/gravel.png --------------------------------------------------------------------------------