tutorial:modding_tips
This is an old revision of the document!
Table of Contents
Modding Tips
Here's a collection of assorted Fabric-related modding tips gleaned from experiences on advising users of the API.
Basics (API)
- Due to the injection-based approach of Fabric's API development, we don't tend to patch classes outright in a way visible to the end user. As such, you may occasionally find Fabric extensions of vanilla classes when you run into something you cannot do. For example:
- Block.Settings → FabricBlockSettings
- EntityType.Builder → FabricEntityTypeBuilder
Mixins
- To modify a constructor, use “<init>” (or “<clinit>” for static constructors) as the method name. Please note that @Inject on constructors only works with @At(“RETURN”) - no other forms of injection are officially supported!
Networking
- Packets always begin execution on the network thread, however accesses to most Minecraft things are not thread-safe. In general, if you're not exactly sure what you're doing, you want to parse the packet on the network thread (read all the values out), then use the task queue to perform additional operations on the main server/client thread.
tutorial/modding_tips.1548164405.txt.gz · Last modified: 2019/01/22 13:40 by asie