Merge branch 'main' of https://github.com/jonasbraus/Minecraft
This commit is contained in:
@@ -144,19 +144,24 @@ public class World : MonoBehaviour
|
|||||||
for (int x = playerChunk.x - Data.viewDistance; x < playerChunk.x + Data.viewDistance; x++)
|
for (int x = playerChunk.x - Data.viewDistance; x < playerChunk.x + Data.viewDistance; x++)
|
||||||
{
|
{
|
||||||
for (int z = playerChunk.z - Data.viewDistance; z < playerChunk.z + Data.viewDistance; z++)
|
for (int z = playerChunk.z - Data.viewDistance; z < playerChunk.z + Data.viewDistance; z++)
|
||||||
|
{
|
||||||
|
if(z >= 0 && x >= 0 && z < worldSize && x < worldSize)
|
||||||
{
|
{
|
||||||
if (chunks[x, z].gameObject == null)
|
if (chunks[x, z].gameObject == null)
|
||||||
{
|
{
|
||||||
chunks[x, z].Initialize();
|
chunks[x, z].Initialize();
|
||||||
chunks[x, z].gameObject.transform.SetParent(gameObject.transform);
|
chunks[x, z].gameObject.transform.SetParent(gameObject.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chunks[x, z].active)
|
if (!chunks[x, z].active)
|
||||||
{
|
{
|
||||||
chunksToUpdate1.Enqueue(new ChunkCoord(x, z));
|
chunksToUpdate1.Enqueue(new ChunkCoord(x, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
checkList.Add(chunks[x, z]);
|
checkList.Add(chunks[x, z]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Chunk c in lastActiveChunks)
|
foreach (Chunk c in lastActiveChunks)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user