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

Enchantment costs #46

Open KlutzyBubbles opened 1 year ago

KlutzyBubbles commented 1 year ago

I have been through issues trying to find answers but no success.

Pre 1.6 this was my config

{
  "allow_removing_curses": true,
  "show_enchantment_cost": true,
  "dedicated_server_options": {
    "alternative_cost_display_enabled": false
  },
  "disenchant_to_book": {
    "enabled": true,
    "consume_enchanted_item": false,
    "cost_config": {
      "count_mode": "count_levels",
      "cost_factor": 0.5,
      "cost_offset": 0.0
    }
  },
  "move_enchantments": {
    "enabled": true,
    "cost_config": {
      "count_mode": "count_enchantments",
      "cost_factor": 0.5,
      "cost_offset": 0.5
    }
  }
}

this is now my current config, with the lack of documentation i couldnt tell if i moved the settings correctly

{
  "allow_removing_curses": true,
  "dedicated_server_options": {
    "alternative_cost_display_enabled": true
  },
  "client_options": {
    "show_enchantment_cost": true
  },
  "disenchant_to_book": {
    "enabled": true,
    "consume_enchanted_item": false,
    "cost_function": {
      "function": {
        "type": "grindenchantments:count_min_power"
      },
      "factor": 0.5,
      "offset": 0.0,
      "type": "grindenchantments:transform"
    }
  },
  "move_enchantments": {
    "enabled": true,
    "cost_function": {
      "function": {
        "function": {
          "normal_factor": 0.5,
          "treasure_factor": 0.5,
          "type": "grindenchantments:count_levels"
        },
        "type": "grindenchantments:first_enchantment"
      },
      "factor": 0.5,
      "offset": 0.5,
      "type": "grindenchantments:transform"
    }
  },
  "version": 2
}

2 things seem to be wrong (For the example i am disenchanting diamond boots with prot 4 and unbreaking 3 to a blank book)

  1. The enchantment cost displayed by the client side mod and the alternative display for vanilla say different values, mod says 25 and vanilla says 28.

  2. With my changed options in the config i wouldnt expect the cost to be so high but again without any documentation on what the numbers actually do i am really just guessing.

Some help with this matter would be greatly appretiated, i am using minecraft 1.20.1, Fabric loader version 0.14.21 and installer version 0.11.2. With grind enchantments version 3.1.2+1.20

mschae23 commented 1 year ago

Yeah, I do agree that most of these config options are not really easy to understand :) That said, I believe there are two different issues here.

  1. The enchantment cost displayed by the client side mod and the alternative display for vanilla say different values, mod says 25 and vanilla says 28.

f you're playing on a dedicated server, make sure the config is the same on both the client and the server – the cost values are not synced. The enchantment cost shown directly in the GUI is added by the client mod, while the one in the item tooltip is added by the server mod.

With my changed options in the config i wouldnt expect the cost to be so high but again without any documentation on what the numbers actually do i am really just guessing.

In some version, I changed the default to be more expensive, but it should still be possible to use the same configuration as in older versions, where it was cheaper.

I believe the difference here is caused by grindenchantments:count_min_power, which should be grindenchantments:count_levels to match your old config.

The number from that is then changed with the values near "transform". It's first multiplied by the factor, and then offset is added.

I hope this helps!

KlutzyBubbles commented 1 year ago

I believe the difference here is caused by grindenchantments:count_min_power, which should be grindenchantments:count_levels to match your old config.

Thank you this worked, however

f you're playing on a dedicated server, make sure the config is the same on both the client and the server – the cost values are not synced. The enchantment cost shown directly in the GUI is added by the client mod, while the one in the item tooltip is added by the server mod.

While this does make sense, wondering if there can be a case to make this instead use the server calculation either by default or always because there will never be a case for the server config and the client config to be different.

It could be done similar to how this mod does it by sending a packet on join https://github.com/Rakambda/FallingTree/blob/minecraft/1.20.1/forge/src/main/java/fr/rakambda/fallingtree/forge/network/ForgePacketHandler.java

The reason for avoiding editing client side config is purely because i dont want to walk everyone who plays on my server through editing a config file, so i can use the vanilla visual for now.

mschae23 commented 1 year ago

The reason for avoiding editing client side config is purely because i dont want to walk everyone who plays on my server through editing a config file, so i can use the vanilla visual for now.

Understandable, although I don't really want to send a packet to every client on join, even if vanilla just ignores it – but maybe I will do that. In the meantime, you don't need to have the mod installed on the client, as it also works purely server-side, and the cost is still displayed in the tooltip.

iLoveeAnime commented 1 year ago

so if u were to change the count_min_power to count_levels? it would fix it entirely and make it cost cheaper?

iLoveeAnime commented 1 year ago

Nvm i did it Free transfering now

CainisMan commented 2 months ago

Nvm i did it Free transfering now

Can you share how you typed it in the config? I'm a bit confused..

Cam396 commented 1 month ago

@CainisMan https://github.com/Cam396/grind-enchantments/actions/runs/9950553376/artifacts/1704636593 this is my fork that is free to transfer

Cam396 commented 1 month ago

use the one that ends in dev

mschae23 commented 1 month ago

https://github.com/Cam396/grind-enchantments/actions/runs/9950553376/artifacts/1704636593 this is my fork that is free to transfer

A more simple way would be to set all the cost_factor and cost_offset values in the config file to 0. That should be enough to make transfers free. If it isn't, that's a bug.

Cam396 commented 1 month ago

https://github.com/Cam396/grind-enchantments/actions/runs/9950553376/artifacts/1704636593 this is my fork that is free to transfer

A more simple way would be to set all the cost_factor and cost_offset values in the config file to 0. That should be enough to make transfers free. If it isn't, that's a bug.

it IS a bug, and configs are broken globally, so you have to change the value that allows it to be taken to true no matter what

Cam396 commented 1 month ago

I did try setting it like that and it didn't fix it

mschae23 commented 1 month ago

configs are broken globally

What do you mean? As far as I can tell, the config file should be working. If it doesn't, you should open a new issue.

jaboiiiiii commented 4 weeks ago

Nvm i did it Free transfering now

can you share your config?

jaboiiiiii commented 4 weeks ago

@CainisMan https://github.com/Cam396/grind-enchantments/actions/runs/9950553376/artifacts/1704636593 this is my fork that is free to transfer

do you have one of these for 1.20.1?

Cam396 commented 4 weeks ago

i dont have one written atm, it might take a bit because of the code refactoring in 1.20.5+