Skip to content

Commit

Permalink
* Fixed ChunkExists(int, int) usage. It expects the ChunkX & ChunkZ c…
Browse files Browse the repository at this point in the history
…oords, not the WorldX & WorldZ.
  • Loading branch information
Gremlin13 authored and Gremlin13 committed Oct 10, 2011
1 parent 1453a19 commit 6db76bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Chraft/World/WorldManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public byte GetBlockId(UniversalCoords coords)

public byte GetBlockId(int worldX, int worldY, int worldZ)
{
if (!ChunkExists(worldX, worldZ))
if (!ChunkExists(worldX >> 4, worldZ >> 4))
return 0;
return (byte)Chunks[worldX >> 4, worldZ >> 4].GetType(worldX & 0xF, worldY, worldZ & 0xF);
}
Expand All @@ -588,7 +588,7 @@ public byte GetBlockData(UniversalCoords coords)

public byte GetBlockData(int worldX, int worldY, int worldZ)
{
if (!ChunkExists(worldX, worldZ))
if (!ChunkExists(worldX >> 4, worldZ >> 4))
return 0;
return Chunks[worldX >> 4, worldZ >> 4].GetData(worldX & 0xF, worldY, worldZ & 0xF);
}
Expand All @@ -602,7 +602,7 @@ public byte GetBlockLight(UniversalCoords coords)

public byte GetBlockLight(int worldX, int worldY, int worldZ)
{
if (!ChunkExists(worldX, worldZ))
if (!ChunkExists(worldX >> 4, worldZ >> 4))
return 0;
return Chunks[worldX >> 4, worldZ >> 4].GetBlockLight(worldX & 0xF, worldY, worldZ & 0xF);
}
Expand Down

0 comments on commit 6db76bc

Please sign in to comment.