diff --git a/Minecraft Client/Assets/Content/Blocks.mat b/Minecraft Client/Assets/Content/Blocks.mat index d33af43..07d3f1f 100644 --- a/Minecraft Client/Assets/Content/Blocks.mat +++ b/Minecraft Client/Assets/Content/Blocks.mat @@ -9,12 +9,13 @@ Material: m_PrefabAsset: {fileID: 0} m_Name: Blocks m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: + m_ShaderKeywords: _ALPHATEST_ON m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout disabledShaderPasses: [] m_SavedProperties: serializedVersion: 3 @@ -57,14 +58,14 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _BumpScale: 1 - - _Cutoff: 0.5 + - _Cutoff: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _GlossMapScale: 1 - _Glossiness: 0 - _GlossyReflections: 1 - _Metallic: 0 - - _Mode: 0 + - _Mode: 1 - _OcclusionStrength: 1 - _Parallax: 0.02 - _SmoothnessTextureChannel: 0 diff --git a/Minecraft Client/Assets/Scenes/Game.unity b/Minecraft Client/Assets/Scenes/Game.unity index adbf723..b827d61 100644 --- a/Minecraft Client/Assets/Scenes/Game.unity +++ b/Minecraft Client/Assets/Scenes/Game.unity @@ -539,6 +539,8 @@ MonoBehaviour: textures: 000000000000 - name: Sand textures: 0a0a0a0a0a0a + - name: Leafs + textures: 101010101010 --- !u!1 &1353507538 GameObject: m_ObjectHideFlags: 0 diff --git a/Minecraft Client/Assets/Scripts/Game/Chunk.cs b/Minecraft Client/Assets/Scripts/Game/Chunk.cs index c3367b5..048ee49 100644 --- a/Minecraft Client/Assets/Scripts/Game/Chunk.cs +++ b/Minecraft Client/Assets/Scripts/Game/Chunk.cs @@ -81,6 +81,19 @@ public class Chunk triangleIndex++; } + AddUV(textures[f]); + } + else if(world.GetBlockID(new Vector3(x + Data.faceChecks[f].x + chunkPosition.x * Data.chunkWidth, + y + Data.faceChecks[f].y, + z + Data.faceChecks[f].z + chunkPosition.z * Data.chunkWidth)) == 6) + { + for (int v = 0; v < 6; v++) + { + vertices.Add(Data.vertices[Data.triangles[f, v]] + new Vector3(x, y, z)); + triangles.Add(triangleIndex); + triangleIndex++; + } + AddUV(textures[f]); } } diff --git a/Minecraft Client/Assets/Scripts/Game/Player.cs b/Minecraft Client/Assets/Scripts/Game/Player.cs index f0dae10..c57ef44 100644 --- a/Minecraft Client/Assets/Scripts/Game/Player.cs +++ b/Minecraft Client/Assets/Scripts/Game/Player.cs @@ -116,7 +116,7 @@ public class Player : MonoBehaviour if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit)) { hit.point -= camera.transform.forward / 10; - client.EditBlock(hit.point, 5); + client.EditBlock(hit.point, 6); } } diff --git a/Minecraft Client/Assets/Scripts/Game/World.cs b/Minecraft Client/Assets/Scripts/Game/World.cs index e80ea5d..bfd8b67 100644 --- a/Minecraft Client/Assets/Scripts/Game/World.cs +++ b/Minecraft Client/Assets/Scripts/Game/World.cs @@ -297,4 +297,24 @@ public class World : MonoBehaviour SceneManager.LoadScene("Login"); deadScreen.SetActive(false); } + + //return the ID of a block + public byte GetBlockID(Vector3 positionInWorld) + { + if (!(positionInWorld.x < 0 || positionInWorld.y < 0 || positionInWorld.z < 0 || + positionInWorld.x >= worldSize * Data.chunkWidth || positionInWorld.y >= Data.chunkHeight || + positionInWorld.z >= worldSize * Data.chunkWidth)) + { + ChunkCoord chunk = new ChunkCoord((int)(positionInWorld.x / Data.chunkWidth), + (int)(positionInWorld.z / Data.chunkWidth)); + + int xInChunk = (int)(positionInWorld.x - chunk.x * Data.chunkWidth); + int yInChunk = (int)positionInWorld.y; + int zInChunk = (int)(positionInWorld.z - chunk.z * Data.chunkWidth); + + return chunks[chunk.x, chunk.z].blocks[xInChunk, yInChunk, zInChunk]; + } + + return 0; + } } \ No newline at end of file