How To Code Minecraft In Javascript (THREE.js) | Part 16 - Different Blocks, Cursor and Some Tweaks

Опубликовано: 08 Октябрь 2024
на канале: Hritik RC
2,066
38

Hey guys! Welcome to part 16 of this 3d minecraft. Yes, finally more block types! In this video, I show you how I added different blocks to the game. Using this algorithm, you can also add your own blocks! I add blocks such as grass, dirt and cobblestone (feel free to add more :D). I use the three.js function for the instanced meshes, the setColorAt function which actually gives a color to the tetxure of an individual instance in the instanced mesh (in our case, it is each block). Unfortunately, this means that all the textures in the world must be the same. To overcome this, I made a constant tetxure for each block, a white texture which I got from the internet and modified a bit. This means that coloring block will make it appear in that added color (since the texture is a white color). I also add a cursor which you all wanted for a long time :) Finally, I also tweaked some of the player movement variables to get a more similar minecraft gameplay. In the next video, I will either code the inventory or add trees!

00:00 - Start
00:09 - Showcase of Different Blocks
01:59 - Cursor
03:18 - New Property of Blocks
03:38 - Blocks Variable
04:41 - New Texture
06:03 - Editing Initial World Generation Code
08:35 - Editing Placing Blocks Code
12:15 - Editing Breaking Blocks Code
13:34 - Editing Infinite Generation Code
15:32 - Tweaking Player Movement Variables

Links:
Check out the code in my GitHub repository : https://github.com/HritikRC/Minecraft...
Intro to this series :    • Coding Minecraft With THREE.js! | Ser...  
Series Playlist :    • How to Code Minecraft  
THREE.js : https://threejs.org/
Perlin Noise Library (remember to include the license!) : https://github.com/josephg/noisejs
Perlin Noise Tutorial :    • 3D Terrain Generation with Perlin Noi...  
Download Python : https://www.python.org
Minecraft World Generation Algorithm : https://github.com/UnknownShadow200/C...
Background Music (Harry Massoud - Breaking of the Fellowship, Piano):    • 17. "The Breaking of the Fellowship" ...