tutorial:side
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:side [2019/05/08 03:22] – liach | tutorial:side [2022/04/13 04:32] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
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 packets (which [[https:// | + | The client |
- | In Minecraft, in order to reduce code, the logical | + | In Fabric, you can often see annotations like '' |
- | net.minecraft.world.World | + | |
- | net.minecraft.entity.Entity | + | |
- | net.minecraft.block.entity.BlockEntity | + | |
- | </ | + | |
- | and a few more. These shared classes allow logical clients to shadow some common game logic from the logical server for easy rendering. (block entities are shadowed to the logical client optionally) | + | |
- | Usually, to identify the shadowed objects on the logical clients from the real ones on the logical server, vanilla and mod code access the World referenced in these objects | + | In Fabric fabric.mod.json and the mixin config, |
- | ==== Client ==== | + | Each physical side ships classes used by its entry point and the data generator classes with entrypoint '' |
- | The logical client is where most displays to the player is done. Rendering (LWJGL), resource pack, player input handling, sounds, etc. all happen on the logical client. | + | |
- | The logical client runs on the main thread of the physical client exclusively. It is not present on the physical server. It is a singleton and always exists. | + | ===== Logical Sides ===== |
- | In yarn, the C2S packets | + | The logical sides are responsible for the actual game logic. |
+ | The logical client | ||
- | ==== Server ==== | + | The client maintains a partial replica |
- | The logical server is where most of the game logic is going on. Data packs, world updates, block entity | + | net.minecraft.class_1937 |
+ | net.minecraft.class_1297 | ||
+ | net.minecraft.class_2586 | ||
+ | </ | ||
+ | These replicated objects allow clients and servers to perform some common | ||
+ | ===== Detailed look into all sides ===== | ||
- | The logical server on the physical client is called the " | + | With an understanding |
- | The logical server never runs on the thread which went through | + | ==== Physical Client ==== |
+ | The physical client is the minecraft jar downloaded by the vanilla launcher. It contains | ||
- | In yarn, the S2C packets are sent from the logical server | + | A physical client can load several different worlds, each within a separate |
- | ===== Physical Sides (EnvType) ===== | + | Compared to the logical server of the physical server |
- | The physical sides refer to the two distributions (jars) of Minecraft game, the client | + | All the logical |
- | In Fabric, you can often see annotations like < | + | Some mods target |
- | In Fabric fabric.mod.json and the mixin config, the client/ | + | ==== Physical Server ==== |
- | Each physical | + | The physical |
- | ==== Client ==== | + | Its logical server differs slightly from that of a physical client |
- | The physical client is the minecraft jar downloaded by the vanilla launcher. It contains a logical client and a logical server | + | |
- | As a physical client can load worlds (launch integrated servers/its logical server) without a limit, but a previous | + | Despite these differences, most mods are applicable without problems to the logical |
- | Compared to the logical server | + | Its features |
- | All the logical client contents are exclusive to the physical | + | Some mods target |
- | Some mods target physical clients exclusively. For instance, Liteloader, Optifine, Minecraft PvP clients (Badlion, Hyperium, etc.) | + | ==== Logical Client ==== |
+ | The logical client is the interface to the player. Rendering (LWJGL), resource pack, player input handling, and sounds happen on the logical client. It is not present on the physical server. | ||
- | ==== Server ==== | + | ==== Logical |
- | The physical | + | The logical |
- | Compared to the physical client, the physical server can only have one world/save as its logical server is a singlton. | + | The logical server on the physical client |
- | Its logical server | + | The logical server |
- | Despite these differences, | + | Most universal |
+ | ===== Communication===== | ||
- | Its features of single world and resource pack sending, however, makes vanilla mod (data pack and resource pack combination) installation much easier compared to on clients, | + | The only correct way to exchange |
- | Some mods target | + | Logical clients send C2S (Client-To-Server) packets to the logical server. |
+ | The logical server sends S2C (Server-To-Client) packets the logical clients. | ||
+ | Packets are sent by a write method in a network thread and received by a call to a read method in a network thread. | ||
+ | |||
+ | For more details on how to handle networking, see [[tutorial: | ||
+ | |||
+ | ===== Common misconceptions about logical servers ===== | ||
+ | Most of the time, mods exclusively targeting the physical server | ||
+ | |||
+ | However, modders for physical servers usually have assumptions which do not apply to integrated servers, including but not limited to: | ||
+ | * Only one logical server instance exists on one game run | ||
+ | * 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 | ||
+ | |||
+ | These assumptions need to be corrected to make mods that run on logical servers. | ||
===== 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.1557285755.txt.gz · Last modified: 2019/05/08 03:22 by liach