-
Notifications
You must be signed in to change notification settings - Fork 1
Loader‐Abstraction
Packages:
org.dimdev.limlib.apiorg.dimdev.limlib.api.client
LimLib passes loader-specific implementations into shared initialization code. Common code should use these interfaces instead of importing Fabric or NeoForge APIs directly.
Implement ModCommon for shared setup:
public interface ModCommon<T extends ISided<?>> {
void init(T sided);
}The Fabric and NeoForge entrypoints call init(...) with their own ISided implementation. Use the supplied object for registration and other loader-dependent work.
ISided covers:
- direct and deferred registry work
- registry callbacks and dynamic registries
- server reload listeners and commands
- packet registration and sending
- config directory lookup and mod-loaded checks
- built-in packs
- entity attributes and creative tab changes
- server and interaction callbacks
- fuels, flammables, and strippables
It extends IRegister, ICreativeTabHandler, and INetworking.
Use IRegister for registry entries, holders, custom registries, registry-phase callbacks, datapack-backed values, and creative tab modification.
Use INetworking to register and send CustomPacketPayload packets encoded with StreamCodec<RegistryFriendlyByteBuf, T>.
Use ICreativeTabHandler to insert items directly or modify a tab through a callback.
Implement ModClient for client-only setup:
void init(T sided);
String getModId();init(...) receives an IClientSided implementation. ModClient also provides hooks for common client registrations:
initParticles(...)initFluids(...)initScreens(...)initBlockEntityRenderers(...)initEntityRenderers(...)initModelLayers(...)initModels(...)initDimensionEffects(...)initShaders(...)delayedInit()
IClientSided handles block render layers, client-player-join callbacks, and client resource reload listeners.
- Fabric:
FabricSided,FabricClientSided - NeoForge:
NeoForgeSided,NeoForgeClientSided