mschae23 / grind-enchantments

Put enchantments back on a book using a grindstone.
https://legacy.curseforge.com/minecraft/mc-mods/grind-enchantments
GNU Lesser General Public License v3.0
12 stars 13 forks source link

Cost calculations not making sense with config entries. #32

Closed Zarepheth closed 2 years ago

Zarepheth commented 2 years ago

I don't know if it is a lack of documentation, a problem in the logic, or the config file is being ignored, but I'm seeing extremely high costs for moving an enchantment from a tool/weapon to a book.

For instance, level 3 efficiency with a cost of 12 levels. I was expecting 0 or 1 level for the cost.

This is my config file:

{
  "allow_removing_curses": true,
  "dedicated_server_options": {
    "alternative_cost_display_enabled": false
  },
  "client_options": {
    "show_enchantment_cost": true
  },
  "disenchant_to_book": {
    "enabled": true,
    "consume_enchanted_item": false,
    "cost_config": {
      "count_mode": {
        "type": "grindenchantments:count_levels"
      },
      "cost_factor": 0.25,
      "cost_offset": 0.0
    }
  },
  "move_enchantments": {
    "enabled": true,
    "cost_config": {
      "count_mode": {
        "delegate": {
          "normal_factor": 0.25,
          "treasure_factor": 0.25,
          "type": "grindenchantments:count_levels"
        },
        "type": "grindenchantments:first_enchantment"
      },
      "cost_factor": 0.25,
      "cost_offset": 0.0
    }
  }
}
Zarepheth commented 2 years ago

Replacing all the 0.25 entries with 4 in my config file does not make much difference in the displayed cost:

Pickaxe with Efficiency 2: Cost 12 Hoe with Efficiency 3, Unbreaking 3: Cost 21 Hoe with Efficiency 3: Cost 15

Updated config:

{
  "allow_removing_curses": true,
  "dedicated_server_options": {
    "alternative_cost_display_enabled": false
  },
  "client_options": {
    "show_enchantment_cost": true
  },
  "disenchant_to_book": {
    "enabled": true,
    "consume_enchanted_item": false,
    "cost_config": {
      "count_mode": {
        "type": "grindenchantments:count_levels"
      },
      "cost_factor": 4,
      "cost_offset": 0.0
    }
  },
  "move_enchantments": {
    "enabled": true,
    "cost_config": {
      "count_mode": {
        "delegate": {
          "normal_factor": 4,
          "treasure_factor": 4,
          "type": "grindenchantments:count_levels"
        },
        "type": "grindenchantments:first_enchantment"
      },
      "cost_factor": 4,
      "cost_offset": 0.0
    }
  }
}
Zarepheth commented 2 years ago

Subsequent tests indicate that the config file is ignored. At least as far as I've modified it.

MeeniMc commented 2 years ago

The file format for the config file has changed between 1.6 and 2.0, you may have to delete the config file, and re-apply your changes after letting the 2.0 version create a new config file. Also, prices are a lot more expensive by default in 2.0

mschae23 commented 2 years ago

Your config is missing the normal_factor and treasure_factor fields for count_levels in the disenchant_to_book case (look for "Error decoding config" in the log). In this case, the mod will simply use the default configuration.

Zarepheth commented 2 years ago

@mschae23 Thank you. I copied the entries from another section, added them to that section and now the costs are what I was expecting.

Note: the default config file was missing those entries. Perhaps because the default had a different cost type?

mschae23 commented 2 years ago

Note: the default config file was missing those entries. Perhaps because the default had a different cost type?

Yes, the default is using the count_min_power type, which does not have those fields (or any other options).