→Handling Packets: add warning about not registering encoders on the physical client. hopefully save someone 3 valuable hours of their life.
Line 83:
Line 83:
<br>
<br>
To avoid this problem, a general rule of thumb is to only access blocks and block entities if <code><nowiki>Level#hasChunkAt</nowiki></code> is true.}}
To avoid this problem, a general rule of thumb is to only access blocks and block entities if <code><nowiki>Level#hasChunkAt</nowiki></code> is true.}}
+
+
{{Colored box|title=Alert|content=Remember that DistExecutor runs on the '''physical side''', not the logical side.
+
<br><br>
+
If you only register an encoder for a clientbound packet on the physical server, your mod will likely crash or present unintended behaviour in single-player worlds. ''Forge will happily send packets that have no encoder defined, '''without a warning or error message!''''' They will be encoded as a 256-long byte buffer filled only with null bytes, by default.