Skip to content

Duplicate Config

Relentless edited this page Aug 11, 2023 · 6 revisions

Description

The duplicates config can be used to configure how duplicate recipes should be handled after the unification process.

Location: config/almostunified/duplicates.json
If you don't find the config, make sure you already loaded a world once.

Explanation

Key Description Example
ignoredRecipeTypes List of recipe types that should be ignored.
supports regex
["minecraft:smelting"]
ignoredRecipes List of recipe IDs that should be ignored.
supports regex
["minecraft:iron_ingot_from_blasting"]
defaultDuplicateRules How duplicate recipes should be handled per default. See below
overrideDuplicateRules Override default rules for specific recipe types. See below
strictMode Whether the duplicate check should be strict. See below

defaultDuplicateRules

This option is an object with two keys: ignoredFields and rules.

The key ignoredFields is a list that describes which entries to ignore in recipe JSONs when comparing two of them to check if they are equal.
A good example would be the conditions key since recipes could be equal even though they have different conditions.
Another example would be the group entry because it describes the recipe category inside the recipe book and is not relevant to the recipe structure itself.

The key rules defines how specific entries in the recipe JSONs should be treated when they have different values. Since the duplicate checks try to find a dominant recipe and remove all others, this criteria defines which recipe to keep in the end.
The cookingtime entry for example defines the number of ticks a smelting recipe requires to finish. If two mods add the same recipe for an ore but they differ in their cooking time, you can define which recipe should be picked in this way.

Currently, possible values for the rules are HigherRule and LowerRule. The HigherRule will choose the recipe with the higher value for the entry and the LowerRule will choose the recipe with the lower value for the entry.

The key shouldSanitize defines whether the recipes should be transformed to catch edge cases where the absence of a count of 1 is not treated equally to the presence of a count of 1.

As an example, with this option turned on (true), the following snippets would be considered equal:

"output": {
  "item": "minecraft:iron_ingot"
}
"output": {
  "item": "minecraft:iron_ingot",
  "count": 1
}
"output": "minecraft:iron_ingot"

This option is turned off by default. It is not recommended to turn this on in the default rules because it increases load times. Instead, turn it on for specific recipe types that you know have this problem.

You should only see this issue appear if you have recipes that are directly injected into the recipe manager with mods like JAOPCA or Emendatus Enigmatica.

overrideDuplicateRules

This option is an object that allows you to override the default duplicate rules mentioned above for specific recipe types. The key is the recipe type and the value is an object with the same structure as the defaultDuplicateRules option.

Note: The override rules are not applied additionally to the default rules but replace them completely. That means that if you want to keep the default rules for a recipe type, you have to copy them over to the overriding rule.

strictMode

The strictMode defines the duplicate checking strategy.

When false, recipes that were unified are only checked against other recipes that were unified, thus not checking against any recipes that already existed in the game before the unification process.

When true, all unified recipes will be checked against all existing recipes of the same recipe type, including recipes that were not unified. This is useful if you want to make sure that no duplicate recipes exist in your modpack. The disadvantage is that this will take a lot longer to process.

In an average modpack with around 300 mods, the strictMode takes around 50 seconds to process. Without strictMode, it takes around 5-6 second.

Default Config

Forge

{
  "ignoredRecipeTypes": [
    "cucumber:shaped_tag"
  ],
  "ignoredRecipes": [],
  "defaultDuplicateRules": {
    "ignoredFields": [
      "conditions",
      "group"
    ],
    "rules": {
      "cookingtime": "HigherRule",
      "energy": "HigherRule",
      "experience": "HigherRule"
    },
    "shouldSanitize": false
  },
  "overrideDuplicateRules": {
    "minecraft:crafting_shaped": {
      "ignoredFields": [
        "conditions",
        "pattern",
        "key",
        "group"
      ],
      "rules": {},
      "shouldSanitize": false
    }
  },
  "strictMode": false
}

Fabric

{
  "ignoredRecipeTypes": [],
  "ignoredRecipes": [],
  "defaultDuplicateRules": {
    "ignoredFields": [
      "fabric:load_conditions",
      "group"
    ],
    "rules": {
      "cookingtime": "HigherRule",
      "energy": "HigherRule",
      "experience": "HigherRule"
    },
    "shouldSanitize": false
  },
  "overrideDuplicateRules": {
    "minecraft:crafting_shaped": {
      "ignoredFields": [
        "fabric:load_conditions",
        "pattern",
        "key",
        "group"
      ],
      "rules": {},
      "shouldSanitize": false
    }
  },
  "strictMode": false
}
Clone this wiki locally