Skip to content

LiquidBurnerFuelJsonLoader crashes on any data/<namespace>/compat/*.json missing a "fluid" field #35

Description

@StayCake

What happened

LiquidBurnerFuelJsonLoader registers itself as super(GSON, "compat"), which makes it scan data/<namespace>/compat/*.json across every namespace in every loaded mod, not just createliquidfuel's own data. If any other mod ships a JSON file under its own data/<their_namespace>/compat/ folder for a completely unrelated purpose, and that JSON object has no "fluid" key, apply() throws a hard RuntimeException and crashes the whole client/server during resource reload.

This actually happened with the Nourished mod (nutrition/food-variety mod), which ships data/nourished/compat/compat_registry.json for its own internal mod-compatibility registry — nothing to do with Create fuels. Because it lives under a compat/ folder, LiquidBurnerFuelJsonLoader picks it up, finds no "fluid" field, and throws:

java.lang.RuntimeException: No fluid specified for liquid burner fuel: nourished:compat_registry
	at com.forsteri.createliquidfuel.core.LiquidBurnerFuelJsonLoader.apply(LiquidBurnerFuelJsonLoader.java:70)

This crashes on every resource reload (including just opening the world list at the title screen), making the two mods completely incompatible even though they have nothing to do with each other.

Where

https://github.com/Forsteri123/CreateLiquidFuel/blob/neoforge/1.21.1/src/main/java/com/forsteri/createliquidfuel/core/LiquidBurnerFuelJsonLoader.java#L66-L71

Suggested fix

Since "compat" is a very generic, easily-colliding folder name to scan across all namespaces, entries that are not actually fuel definitions should be skipped with a warning log instead of crashing the whole game:

                     } catch (ResourceLocationException e) {
-                        throw new RuntimeException("Fluid liquid burner fuel " + id + " has invalid fluid: " + fluidElement.getAsString());
+                        CreateLiquidFuel.LOGGER.warn("Skipping liquid burner fuel {}: invalid fluid {}", id, fluidElement.getAsString());
                     }
                 } else {
-                    throw new RuntimeException("No fluid specified for liquid burner fuel: " + id);
+                    CreateLiquidFuel.LOGGER.warn("Skipping {}: not a liquid burner fuel definition (no \"fluid\" field)", id);
                 }

Version

  • Create: Liquid Fuel 2.1.1 (neoforge/1.21.1)
  • Minecraft 1.21.1, NeoForge 21.1.248

This issue was automatically written with AI, so it could have any errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions