Code breaks game

https://preview.redd.it/tyi1dadd4q6e1.png?width=981&format=png&auto=webp&s=bd717755576a0108bcc4125a4b8cd2471ee44a92

This code completely breaks my game. Unrendered chunks are cut off into the void, chat doesnt work, and commands dont either. This is executed when a entity spawns.