tutorial:side
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:side [2019/05/08 03:22] – liach | tutorial:side [2022/02/09 16:56] – [Communication] grammar fix waffel | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Side ====== | ====== Side ====== | ||
+ | Minecraft uses the [[https:// | ||
- | In Minecraft | + | The concept of client/ |
- | For both types of " | + | For both types of sides, there is a 'client' |
- | Usually, the logical sides have slightly more importance over the physical sides, for they have a bigger impact to the engine and modder' | + | The logical sides are central in the architecture of both distributions of Minecraft. Therefore, an understanding of logical sides is vital for any mod development with Fabric. |
- | ===== Logical | + | ===== Physical |
- | Logical | + | The physical |
+ | |||
+ | The client and server | ||
+ | |||
+ | In Fabric, you can often see annotations like '' | ||
+ | |||
+ | In Fabric fabric.mod.json | ||
+ | |||
+ | Each physical side ships classes used by its entry point and the data generator classes with entrypoint '' | ||
+ | |||
+ | ===== Logical Sides ===== | ||
- | The packets (which [[https:// | + | The logical |
+ | The logical | ||
- | In Minecraft, in order to reduce code, the logical client and servers share some logic classes, including< | + | The client maintains a partial replica of the server' |
net.minecraft.world.World | net.minecraft.world.World | ||
net.minecraft.entity.Entity | net.minecraft.entity.Entity | ||
net.minecraft.block.entity.BlockEntity | net.minecraft.block.entity.BlockEntity | ||
</ | </ | ||
- | and a few more. These shared classes | + | These replicated objects |
+ | ===== Detailed look into all sides ===== | ||
- | Usually, | + | With an understanding of which sides there are and how to distinguish between them, we can now look at each side in detail. |
- | ==== Client ==== | + | ==== Physical |
- | The logical | + | The physical |
- | The logical client runs on the main thread of the physical client | + | A physical client |
- | In yarn, the C2S packets are sent from the logical | + | Compared to the logical |
- | ==== Server ==== | + | All the logical |
- | The logical | + | |
- | The logical server on the physical | + | Some mods target |
- | The logical server never runs on the thread which went through the entrypoint of a physical side, even on physical servers. Still, it has its own thread, on which it handles its logic. It is a singleton that always exists on physical servers; on the physical client, it exists one instance at a time when the player is playing a local save, and a new instance is created every time the player loads a local save. | + | ==== Physical Server ==== |
- | In yarn, the S2C packets are sent from the logical server (which calls write method in a network thread), and the C2S packets are received by the logical | + | The physical server is the java dedicated server. Compared to a physical client, it only has a logical server (dedicated server). Its entrypoint is '' |
- | ===== Physical Sides (EnvType) ===== | + | Its logical server differs slightly from that of a physical client as only one logical server instance is ever present when the physical server is running. Moreover, the logical server of the physical server can be controlled remotely via Rcon, has a config file called server.properties, |
- | The physical sides refer to the two distributions (jars) | + | Despite these differences, |
- | In Fabric, you can often see annotations like < | + | Its features of single world and resource pack sending, however, make vanilla mod (data pack and resource pack combination) installation much easier compared to on clients, as vanilla |
- | In Fabric fabric.mod.json and the mixin config, the client/ | + | Some mods target physical server exclusively. For instance, Bukkit |
- | Each physical side ships classes used by its respective entry point and the data generator classes with entrypoint< | + | ==== Logical Client ==== |
+ | The logical client is the interface to the player. Rendering (LWJGL), resource pack, player input handling, | ||
- | ==== Client | + | ==== Logical Server |
- | The physical client | + | The logical server |
- | As a physical client can load worlds (launch integrated servers/ | + | The logical server |
- | Compared to the logical server of the physical server | + | The logical server |
- | All the logical | + | Most universal mods target |
+ | ===== Communication===== | ||
- | Some mods target physical | + | The only correct way to exchange data between logical |
- | ==== Server | + | Logical clients send C2S (Client-To-Server) packets to the logical |
- | The physical server is the java dedicated | + | The logical server |
+ | Packets are sent by a write method in a network thread and received by a call to a read method in a network thread. | ||
- | Compared | + | For more details on how to handle networking, see [[tutorial: |
- | Its logical | + | ===== Common misconceptions about logical |
+ | Most of the time, mods exclusively targeting | ||
- | Despite these differences, most mods are fine and applicable to the logical servers of both the physical | + | However, modders for physical |
+ | * Only one logical | ||
+ | * The world and entities should always calculate the game logic (i.e., the isClient field of the world object is always false) | ||
+ | * Remote control, resource pack sending, and Favicon are present | ||
- | Its features of single world and resource pack sending, however, makes vanilla mod (data pack and resource pack combination) installation much easier compared | + | These assumptions need to be corrected |
- | + | ||
- | Some mods target physical server exclusively. For instance, Bukkit and its derivatives (Spigot, Paper, Cauldron, Xxx-Bukkit hybrids) always target the physical server. | + | |
===== Conclusion ===== | ===== Conclusion ===== | ||
Line 79: | Line 96: | ||
Ultimately, the main confusion comes from the fact that logical servers exist on physical clients. | Ultimately, the main confusion comes from the fact that logical servers exist on physical clients. | ||
- | |||
- | ==== Logical Server in Physical Client ==== | ||
- | and modders on those platforms have incorrect assumptions of logical servers in general, including but not limited to: | ||
- | * Only one logical server instance will ever exist on one game run | ||
- | * The world and entities should always calculate the game logic (i.e. the World.isClient field is always false) | ||
- | * Remote control, resource pack sending, and Favicon are present | ||
tutorial/side.txt · Last modified: 2022/04/13 04:32 by 127.0.0.1