Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enchantment costs #46

Open
KlutzyBubbles opened this issue Jul 23, 2023 · 15 comments
Open

Enchantment costs #46

KlutzyBubbles opened this issue Jul 23, 2023 · 15 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@KlutzyBubbles
Copy link

KlutzyBubbles commented Jul 23, 2023

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
Copy link
Owner

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.

  • count_min_power: Uses the "minimum enchanting table power" of all enchantments on the tool – this technically has a different purpose (as you can tell from its name), but I chose it because it usually correlates with the strength of the enchantment.
  • count_levels: Simply adds all enchantment levels on the tool. So if you have Efficiency IV and Unbeaking III, the resulting value would be 4 + 3 = 7.

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!

@mschae23 mschae23 added documentation Improvements or additions to documentation question Further information is requested labels Jul 23, 2023
@KlutzyBubbles
Copy link
Author

KlutzyBubbles commented Jul 24, 2023

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
Copy link
Owner

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
Copy link

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

@iLoveeAnime
Copy link

Nvm i did it
Free transfering now

@CainisMan
Copy link

Nvm i did it Free transfering now

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

@Cam396
Copy link

Cam396 commented Jul 16, 2024

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

@Cam396
Copy link

Cam396 commented Jul 16, 2024

use the one that ends in dev

@mschae23
Copy link
Owner

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
Copy link

Cam396 commented Jul 17, 2024

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
Copy link

Cam396 commented Jul 17, 2024

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

@mschae23
Copy link
Owner

mschae23 commented Jul 17, 2024

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
Copy link

Nvm i did it Free transfering now

can you share your config?

@jaboiiiiii
Copy link

@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
Copy link

Cam396 commented Aug 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants