Lithium (Fabric/NeoForge)

Lithium (Fabric/NeoForge)

36M Downloads

Lithium 0.9.0 hopper optimization may cause NPE with other mods

Fallen-Breath opened this issue ยท 1 comments

commented

Instructions

The following @ModifyVariable sets the booleanSupplier variable to null, causing mods accessing this variable throwing NPE after this @ModifyVariable

https://github.com/CaffeineMC/lithium-fabric/blob/5511cedec922e1e69746cb60cc2ec17d778b2458/src/main/java/me/jellysquid/mods/lithium/mixin/world/block_entity_ticking/sleeping/hopper/HopperBlockEntityMixin.java#L60-L68

And the variable being null is only used in the following injection

https://github.com/CaffeineMC/lithium-fabric/blob/5511cedec922e1e69746cb60cc2ec17d778b2458/src/main/java/me/jellysquid/mods/lithium/mixin/world/block_entity_ticking/sleeping/hopper/HopperBlockEntityMixin.java#L70-L79

Example

Example compatibility issue with Carpet-TIS-Addition mod

TISUnion/Carpet-TIS-Addition#81

Reproduced by

  • Minecraft version: 1.19.2
  • Fabric Carpet version: 1.4.83
  • Carpet TIS Addition version: 1.40.1
  • Lithium version: 0.9.1

Mixined classes:

// net.minecraft.block.entity.HopperBlockEntity#insertAndExtract

    // ....

    booleanSupplier = localvar$bod000$rememberBranch(booleanSupplier);  // <-- lithium sets booleanSupplier to null
    if (bl) {
        blockEntity.setTransferCooldown(8);
        handler$bdd000$doHopperCountersUnlimitedSpeed(world, pos, state, blockEntity, booleanSupplier, (CallbackInfoReturnable)null);   // <-- NPE
        markDirty(world, pos, state);
        return true;
    }
}

handler$bod000$sleepIfBranchNotRemembered(world, pos, state, blockEntity, booleanSupplier, (CallbackInfoReturnable)null);
return false;
commented

64078c5 should fix this