calculates shadows is super hacky and inefficient (explains why it lags so much?)
shadows are difficult, in this case they're actually pretty well done given the constraints
personally I feel like shadows should be shapes added to the shadow layer, which would work well for squared off bricks, but for other shapes (blockheads, items, vehicles, ramps, arches...) it's going to be expensive to compute
the sun also changes position constantly, so the shapes would have to be recalculated every frame, which is fine for square bricks, but not for anything else