@Override public int getBlockMetadataAt(BlockLocation blockLocation) { ChunkLocation location = new ChunkLocation(blockLocation); BlockLocation chunkBlockOffset = new BlockLocation(location); Chunk chunk = getChunkAt(location); if (chunk == null) return 0; int metadata = chunk.getBlockMetadataAt( blockLocation.getX() - chunkBlockOffset.getX(), blockLocation.getY() - chunkBlockOffset.getY(), blockLocation.getZ() - chunkBlockOffset.getZ()); return metadata; }
@Override public Block getBlockAt(BlockLocation location) { ChunkLocation chunkLocation = new ChunkLocation(location); Chunk chunk = getChunkAt(chunkLocation); if (chunk == null) return null; BlockLocation chunkBlockOffset = new BlockLocation(chunkLocation); int chunkOffsetX = location.getX() - chunkBlockOffset.getX(); int chunkOffsetY = location.getY() - chunkBlockOffset.getY(); int chunkOffsetZ = location.getZ() - chunkBlockOffset.getZ(); int id = chunk.getBlockIdAt(chunkOffsetX, chunkOffsetY, chunkOffsetZ); int metadata = chunk.getBlockMetadataAt(chunkOffsetX, chunkOffsetY, chunkOffsetZ); return new Block(this, chunk, location, id, metadata); }