Skip to content

Instantly share code, notes, and snippets.

@t81lal
Created January 29, 2015 16:54
Show Gist options
  • Save t81lal/363099554d6c66c7c568 to your computer and use it in GitHub Desktop.
Save t81lal/363099554d6c66c7c568 to your computer and use it in GitHub Desktop.
MineNet block set
@Override
public void setBlockData(int data, BlockLocation loc) {
int x = loc.getX(), y = loc.getY(), z = loc.getZ();
int chunkX = x >> 4, chunkY = y >> 4, chunkZ = z >> 4;
int chunkBaseX = chunkX << 4, chunkBaseY = chunkY << 4, chunkBaseZ = chunkZ << 4;
Chunk chunk = getChunkAt(new ChunkLocation(chunkX, chunkY, chunkZ));
chunk.getBlocks().set(x - chunkBaseX, y - chunkBaseY, z - chunkBaseZ, data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment