Update chunk.c

Fix some shifty math
Add flag and level retrieving functions