Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

NoClassDefFoundError: MovementBehaviour when Create 6.0.6 present (Chisels & Bits 1.4.148)

Gniewny1 opened this issue · 0 comments

commented

Short description
Chisels & Bits (chisels-and-bits-forge-1.4.148) attempts to load its Create compatibility plugin and throws a NoClassDefFoundError for
com.simibubi.create.content.contraptions.behaviour.MovementBehaviour when Create 6.0.6 is present. The plugin detection/instantiation should be resilient to missing/incompatible host-mod classes.


Environment

  • Minecraft: 1.20.1
  • Forge: 47.4.0
  • Chisels & Bits: chisels-and-bits-forge-1.4.148.jar
  • Create: create-1.20.1-6.0.6.jar
  • Java: 17 (Temurin-17)
  • Mappings: Parchment (if relevant) — I used parchment 2023.06.26-1.20.1

Steps to reproduce

  1. Put chisels-and-bits-forge-1.4.148.jar and create-1.20.1-6.0.6.jar into the mods/ folder.
  2. Start Minecraft with Forge 1.20.1.
  3. Observe the logs during mod loading / startup.

Expected behavior
If Create is missing or its API changed, Chisels & Bits should:

  • skip loading the Create compatibility plugin gracefully, or
  • detect the incompatible Create API and log a clear compatibility message,
    without throwing NoClassDefFoundError during mod initialization.

Actual behavior / stack trace (excerpt)
Chisels & Bits logs an error while trying to instantiate the Create plugin:

[modloading-worker-0/ERROR] [mod.chiselsandbits.api.util.ClassUtils/]: Failed to load: mod.chiselsandbits.forge.compat.create.CreateCandBPlugin
java.lang.NoClassDefFoundError: com.simibubi.create.content.contraptions.behaviour.MovementBehaviour
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:375)
at mod.chiselsandbits.api.util.ClassUtils.createOrGetInstance(ClassUtils.java:45)
at mod.chiselsandbits.forge.platform.ForgePluginDiscoverer.createPluginFrom(ForgePluginDiscoverer.java:95)
at mod.chiselsandbits.forge.platform.ForgePluginDiscoverer.loadPlugins(ForgePluginDiscoverer.java:58)
at mod.chiselsandbits.plugin.PluginManger.detect(PluginManger.java:35)
at mod.chiselsandbits.ChiselsAndBits.(ChiselsAndBits.java:62)
...
Caused by: java.lang.ClassNotFoundException: com.simibubi.create.content.contraptions.behaviour.MovementBehaviour
at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:141)
...

Workarounds

  • Downgrade Create to a 0.5.1.x series build compatible with Chisels & Bits (this removes the exception).
  • Remove Chisels & Bits if you require Create 6.x for other mods.
  • Run separate modpacks: one with Create 6.x (for addons that require it) and one with Create 0.5.1 (for C&B compatibility).

Suggested fix / recommended change
The root cause is that the plugin attempts to instantiate Create-specific classes unconditionally (via reflection) without verifying Create is present or confirming the expected API surface. Please consider one or more of the following safe approaches:

  1. Guard plugin instantiation with a mod presence check:
if (!ModList.get().isLoaded("create")) {
    LOGGER.info("Create not present: skipping Create compatibility plugin.");
} else {
    // optional: check Create version
    // try to instantiate plugin with try/catch
}

[latest.log](https://github.com/user-attachments/files/21704279/latest.log)