User Tools

Site Tools


tutorial:side

This is an old revision of the document!


Side

In Minecraft game and modding, there are concepts of logical and physical sides. Understanding of sides is crucial to understanding Minecraft's inner workings.

For both types of “side”s, there are “client” and “server”. However, the logical client does not equate to the physical client, and the logical server does not equate to the physical server either.

Usually, the logical sides have slightly more importance over the physical sides, for they have a bigger impact to the engine and modder's code.

Logical Sides

Logical sides are mainly about the threads the game run on, including the Client (does rendering, sends player inputs to the server, handles resource packs, etc.) and the Server (calculates most core logic, handles data packs, keeps the world/game data, etc.) threads.

Client

Server

The logical server is where most of the game logic is going on. Data packs, world updates, block entity and entity ticks, mob AI, game/world saving, world generation, etc. all happen on the logical server.

Physical Sides (EnvType)

The physical sides refer to the two distributions (jars) of Minecraft game, the client (what the vanilla launcher launches) and the server (download available on minecraft.net for free), which are launched in different ways.

In Fabric, you can often see annotations like

@Environment(EnvType.CLIENT)

This indicates that some code is present only on one physical side, in this case here, on the client.

Each physical side ships classes used by its respective entry point and the data generator classes with entrypoint

net.minecraft.data.Main

Client

The physical client is the minecraft jar downloaded by the vanilla launcher. It contains a logical client and a logical server. Its entrypoint is

net.minecraft.client.main.Main

.

Server

The physical server is the java dedicated server. Compared to a physical client, it only has a logical server. Its entrypoint is

net.minecraft.server.MinecraftServer

Compared to the physical client, the physical server can only have one world/save.

Its logical server differs slightly from that of a physical client as only one logical server instance will be ever present when the physical server is ran. Moreover, the logical server of the physical server can be controlled remotely via Rcon, has server.properties, and can send server resource packs.

Despite these differences, most mods are fine and applicable to the logical servers of both the physical client and the physical server. Plugins, however, need to discard their assumptions that only one server will ever be present in a game run and need to stop holding a server instance in their plugin instances.

Its features of single world and resource pack sending, however, makes vanilla mod (data pack and resource pack combination) usage much easier, as vanilla physical clients will be set up when connecting to the server automatically.

Some mods target physical server exclusively. For instance, Bukkit and its derivatives (Spigot, Paper, Cauldron, Xxx-Bukkit hybrids) always target the physical server, and modders on those platforms have incorrect assumptions of logical servers in general, especially the single server instance ever created assumption mentioned above.

Conclusion

Possible combinations of physical and logical sides:

Logical Client Logical Server
Physical Client Exists Exists
Physical Server Does Not Exist Exists

Ultimately, the main confusion comes from the fact that logical servers exist on physical clients.

Logical Server in Physical Client

tutorial/side.1557281860.txt.gz · Last modified: 2019/05/08 02:17 by liach