Botania

Botania

133M Downloads

[addon dev] ItemBaubles cannot be instantiated before Botania loads

quat1024 opened this issue ยท 1 comments

commented

Mod Loader

Fabric

Minecraft Version

1.18.2

Botania version

1.18.1-431-FABRIC-SNAPSHOT

Modloader version

fabricLoaderVersion=0.13.3 fabricApiVersion=0.47.10+1.18.2

Modpack info

Incorporeal 3 dev instance

The latest.log file

not sure how useful this is because there's no commit corresponding to it but here you go https://paste.ee/p/ZchRJ

Issue description

ItemBauble's constructor requires EquipmentHandler.instance to be nonnull:

Both loaders call EquipmentHandler.init() on mod construction, initializing that field:

private void coreInit() {
FiberBotaniaConfig.setup();
EquipmentHandler.init();
FabricPacketHandler.init();
}

However, on Fabric with unspecified mod load ordering, this initialization is not guaranteed to happen before the first ItemBauble is constructed (like an addon that wants to add more ItemBaubles).

Steps to reproduce

  • Make a mod that calls new ItemMonocle
  • Wonder where all those spurious crashes are coming from
  • Remember that Fabric has unspecified mod load ordering

Other information

Currently I'm working around this by calling EquipmentHandler.init from my side before constructing my ItemBaubles, and using a hacky mixin to prevent Botania from calling init after I do it because it's not safe to call twice. This appears to work fine.

commented

"fixed" by just making equipmenthandler.init safe to call multiple times