Where, what and who
This principle is how most of the events we are going to learn about work. Let's start with what is generally understood as an event? In addition to the obvious in-game events, events can depend on other mods, be called randomly or with a certain periodicity, and even come from the server side. We will consider each of these types, but not immediately, and not even in this chapter, but only when they are really needed.
Callbacks
From the phrase call + back, it is with their help that we will register event handlers. As the name implies, we will receive a call, and then we can cancel further action. However, not all actions can be canceled, and those that can be can be canceled either by another mod or by the engine. But let's focus on handling callbacks.
Updatables
These are objects built around an update function. Updates are called every tick (1/20 of a second), which can interact with the world in any way and perform long-term operations. An integral part of the engine, on which most of the life cycle is based.
Threading
Multithreading is of paramount importance for any modern system, environment, application, and simply for a script. But not in the case of Minecraft. This game uses one thread for practically everything: rendering interfaces, world generation, rendering entities, and more. So far this works identically on all editions of the game, creating performance issues and raising system requirements. But is everything really so bad and when can you use multiple threads, and also, why do we even need this. Let's figure it out.