→Server: Document filters |
→Client: Document client config |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 94: | Line 94: | ||
The <code>server.json</code> file contains the majority of the mod's configuration options, being used on the logical server. Most importantly, it is possible to disable certain features and change the disenchantment costs. | The <code>server.json</code> file contains the majority of the mod's configuration options, being used on the logical server. Most importantly, it is possible to disable certain features and change the disenchantment costs. | ||
{{Tree view| | |||
* {{Json|object}}: server config. | * {{Json|object}}: server config. | ||
** {{Json|object|disenchant_to_book}}: configuration for the “disenchant to book” feature. | ** {{Json|object|disenchant_to_book}}: configuration for the “disenchant to book” feature. | ||
| Line 111: | Line 111: | ||
*** {{Json|boolean|enabled}}: whether filters are in effect (default: <code>true</code>). | *** {{Json|boolean|enabled}}: whether filters are in effect (default: <code>true</code>). | ||
*** {{Json|object|item}}: which items can be used in disenchanting, or repair cost resets. | *** {{Json|object|item}}: which items can be used in disenchanting, or repair cost resets. | ||
**** {{Json|array|enchantments}} (misnamed; should have been | **** {{Json|array|enchantments}} (misnamed; should have been {{Json key|"items"}}): list of item IDs, to be used as either an allowlist or denylist. If set to an empty array, all item types can be used (default: <code>[]</code>). | ||
**** {{Json|string|action}}: if set to <code>"allow"</code>, ''only'' the mentioned items can be used. If set to <code>"deny"</code>, all items but the mentioned ones can be used (default: <code>"deny"</code>). | **** {{Json|string|action}}: if set to <code>"allow"</code>, ''only'' the mentioned items can be used. If set to <code>"deny"</code>, all items but the mentioned ones can be used (default: <code>"deny"</code>). | ||
*** {{Json|object|enchantment}}: which enchantments can be extracted from items. | *** {{Json|object|enchantment}}: which enchantments can be extracted from items. | ||
| Line 118: | Line 118: | ||
*** {{Json|string|cursed_enchantments}}: if set to <code>"allow"</code>, curses are not treated specially. If set to <code>"ignore"</code>, curses will remain on the item when disenchanting. If set to <code>"deny"</code>, cursed items cannot be used at all (default: <code>"ignore"</code>). | *** {{Json|string|cursed_enchantments}}: if set to <code>"allow"</code>, curses are not treated specially. If set to <code>"ignore"</code>, curses will remain on the item when disenchanting. If set to <code>"deny"</code>, cursed items cannot be used at all (default: <code>"ignore"</code>). | ||
** {{Json|int|version}}: config version (latest: <code>4</code>). | ** {{Json|int|version}}: config version (latest: <code>4</code>). | ||
}} | |||
=== Cost function === | === Cost function === | ||
A cost function takes the list of enchantments on the item and calculates a level cost. It can be specified separately for each of the mod's features. | |||
</ | |||
{{Tree view| | |||
* {{Json|object|cost_function}} | |||
** if {{Json|string|type}} is <code>"grindenchantments:count_min_power"</code>: sums the minimum required [[mcw:Enchanting_mechanics|enchanting power]] needed to obtain the enchantment on an enchanting table, usually scaling with the enchantment's level. This is a defined value even for enchantments that are unobtainable at an enchanting table. | |||
** if {{Json|string|type}} is <code>"grindenchantments:count_enchantments"</code>: returns the number of enchantments on the item (be aware that <code>"grindenchantments:first_enchantment"</code> will always reduce this to <code>1</code>). | |||
** if {{Json|string|type}} is <code>"grindenchantments:count_levels"</code>: sums the levels of all enchantments on the item. Enchantments without a level are counted as <code>1</code>. | |||
*** {{Json|float|normal_factor}}: value to multiply the level count of normal (non-treasure) enchantments with. For example, if this is set to <code>3.0</code> and you are disenchanting an item with Unbreaking II, it would cost 6 levels of XP. | |||
*** {{Json|float|treasure_factor}}: value to multiply the level count of treasure enchantments (which are unobtainable at an enchanting table) with. | |||
** if {{Json|string|type}} is <code>"grindenchantments:average_count"</code>: divides the level cost returned by another cost function by the number of enchantments on the item (be aware that <code>"grindenchantments:first_enchantment"</code> will always reduce this to <code>1</code>, making it ineffective). | |||
*** {{Json|object|function}}: The cost function to delegate the initial level cost calculation to. | |||
** if {{Json|string|type}} is <code>"grindenchantments:first_enchantment"</code>: removes all enchantments but the first from the item before passing the actual level cost calculation to another cost function. | |||
*** {{Json|object|function}}: The cost function to delegate the remaining level cost calculation to. | |||
** if {{Json|string|type}} is <code>"grindenchantments:transform"</code>: changes the result of another cost function based on the formula <code><nowiki>result = (cost * factor) + offset</nowiki></code>. The result is rounded up to the next integer. | |||
*** {{Json|object|function}}: The cost function to delegate the initial level cost calculation to. | |||
*** {{Json|float|factor}}: the value to multiply the level cost with (default: <code>1.0</code>). | |||
*** {{Json|float|offset}}: the value to add to the multiplied level cost (default: <code>0.0</code>). | |||
** if {{Json|string|type}} is <code>"grindenchantments:filter"</code>: applies the configured filter, to remove ignored enchantments. Should typically be the outermost cost function. Without this, ignored enchantments (which will remain on the original item) will still be taken into account for the level cost. | |||
*** {{Json|object|function}}: The cost function to delegate the remaining level cost calculation to. | |||
}} | |||
== Client == | |||
The <code>client.json</code> file contains some options that are exclusively used on the client side. Because the mod is compatible with vanilla clients, the only feature here is the display of the required XP cost. | |||
{{Tree view| | |||
* {{Json|object}}: client config. | |||
** {{Json|boolean|show_enchantment_cost}}: can be used to stop showing the level cost on the client entirely. Levels will still be deducted when taking the resulting item, even if this is disabled (default: <code>true</code>). | |||
** {{Json|object|sync_options}}: controls the mod's config sync feature, where the server sends its config to any compatible client when connecting. This means that even if the <code>server.json</code> file on the phsyical client doesn't match the server's configuration, the displayed level costs will still be accurate. | |||
*** {{Json|boolean|use_local_server_config_if_unsynced}}: fall back to the local <code>server.json</code> file on the physical client in case the server does not send any configuration. If this is disabled, the client will not show a level cost on grindstone operations at all, even if it looks like one added by this mod. Should only be required for backwards compatibility with servers running old versions of the mod from before the config sync feature was added (default: <code>true</code>). | |||
*** {{Json|boolean|log_received_config}}: when receiving the server's configuration, log it in the console in JSON format. Useful for debugging, or if you're curious how the server is configured (default: <code>false</code>). | |||
}} | |||
Latest revision as of 10:35, 20 October 2025
The configuration files of Grind enchantments can be found in the .minecraft/config/grindenchantments directory. If you don't know how to find this, see the .minecraft page on the Minecraft wiki. If the files don't exist, the mod will create them automatically.
There should be two files here: server.json and client.json.
Defaults
The default values in the server config:
{
"disenchant_to_book": {
"enabled": true,
"consume_enchanted_item": false,
"cost_function": {
"function": {
"function": {
"type": "grindenchantments:count_min_power"
},
"factor": 0.3,
"offset": 8.0,
"type": "grindenchantments:transform"
},
"type": "grindenchantments:filter"
}
},
"move_enchantments": {
"enabled": true,
"cost_function": {
"function": {
"function": {
"function": {
"normal_factor": 3.0,
"treasure_factor": 8.0,
"type": "grindenchantments:count_levels"
},
"factor": 0.5,
"offset": 0.5,
"type": "grindenchantments:transform"
},
"type": "grindenchantments:first_enchantment"
},
"type": "grindenchantments:filter"
}
},
"reset_repair_cost": {
"enabled": false,
"catalyst_items": "minecraft:diamond",
"requires_enchantment": true,
"cost_function": {
"function": {
"function": {
"normal_factor": 1.0,
"treasure_factor": 4.0,
"type": "grindenchantments:count_levels"
},
"type": "grindenchantments:average_count"
},
"factor": 1.5,
"offset": 4.0,
"type": "grindenchantments:transform"
}
},
"filter": {
"enabled": true,
"item": {
"enchantments": [],
"action": "deny"
},
"enchantment": {
"enchantments": [],
"action": "ignore"
},
"cursed_enchantments": "ignore"
},
"dedicated_server_options": {
"alternative_cost_display_enabled": false
},
"version": 4
}
The default values in the client config:
{
"show_enchantment_cost": true,
"sync_options": {
"use_local_server_config_if_unsynced": true,
"log_received_config": false
},
"version": 4
}
Server
The server.json file contains the majority of the mod's configuration options, being used on the logical server. Most importantly, it is possible to disable certain features and change the disenchantment costs.
- object: server config.
- "disenchant_to_book" (object): configuration for the “disenchant to book” feature.
- "enabled" (boolean): whether to enable the feature (default:
true). - "consume_enchanted_item" (boolean): if enabled, the original item will be consumed when disenchanting; only the enchantments themselves can be obtained (default:
false). - "cost_function" (object): see cost function.
- "enabled" (boolean): whether to enable the feature (default:
- "move_enchantments" (object): configuration for the “move enchantments between books” feature.
- "enabled" (boolean): whether to enable the feature (default:
true). - "cost_function" (object): see cost function.
- "enabled" (boolean): whether to enable the feature (default:
- "reset_repair_cost" (object): configuration for the “reset repair cost” feature.
- "enabled" (boolean): whether to enable the feature (default:
false). - "catalyst_items" (array): an array of item IDs (or a single item ID) which have to be inserted alongside the item that should have its repair cost reset (default:
"minecraft:diamond"). - "requires_enchantment" (boolean): whether the item that should have its repair cost reset is required to have an enchantment (default:
true). - "cost_function" (object): see cost function.
- "enabled" (boolean): whether to enable the feature (default:
- "filter" (object): filters for all enchantment movements. Vanilla functionality (simple disenchanting without keeping enchanted books) should not be affected.
- "enabled" (boolean): whether filters are in effect (default:
true). - "item" (object): which items can be used in disenchanting, or repair cost resets.
- "enchantments" (array) (misnamed; should have been "items"): list of item IDs, to be used as either an allowlist or denylist. If set to an empty array, all item types can be used (default:
[]). - "action" (string): if set to
"allow", only the mentioned items can be used. If set to"deny", all items but the mentioned ones can be used (default:"deny").
- "enchantments" (array) (misnamed; should have been "items"): list of item IDs, to be used as either an allowlist or denylist. If set to an empty array, all item types can be used (default:
- "enchantment" (object): which enchantments can be extracted from items.
- "enchantments" (array): list of enchantment IDs, to be used as either an allowlist or denylist. If set to an empty array, all enchantment types can be used, as long as no other filter applies (default:
[]). - "action" (string): if set to
"allow", only the specified enchantments can be extracted (other enchantments will remain on the item). If set to"ignore", only enchantments that aren't listed can be extracted (the specified enchantments will remain on the item). If set to"deny", items that have any of the listed enchantments cannot be used at all (default:"ignore").
- "enchantments" (array): list of enchantment IDs, to be used as either an allowlist or denylist. If set to an empty array, all enchantment types can be used, as long as no other filter applies (default:
- "cursed_enchantments" (string): if set to
"allow", curses are not treated specially. If set to"ignore", curses will remain on the item when disenchanting. If set to"deny", cursed items cannot be used at all (default:"ignore").
- "enabled" (boolean): whether filters are in effect (default:
- "version" (int): config version (latest:
4).
- "disenchant_to_book" (object): configuration for the “disenchant to book” feature.
Cost function
A cost function takes the list of enchantments on the item and calculates a level cost. It can be specified separately for each of the mod's features.
- "cost_function" (object)
- if "type" (string) is
"grindenchantments:count_min_power": sums the minimum required enchanting power needed to obtain the enchantment on an enchanting table, usually scaling with the enchantment's level. This is a defined value even for enchantments that are unobtainable at an enchanting table. - if "type" (string) is
"grindenchantments:count_enchantments": returns the number of enchantments on the item (be aware that"grindenchantments:first_enchantment"will always reduce this to1). - if "type" (string) is
"grindenchantments:count_levels": sums the levels of all enchantments on the item. Enchantments without a level are counted as1.- "normal_factor" (float): value to multiply the level count of normal (non-treasure) enchantments with. For example, if this is set to
3.0and you are disenchanting an item with Unbreaking II, it would cost 6 levels of XP. - "treasure_factor" (float): value to multiply the level count of treasure enchantments (which are unobtainable at an enchanting table) with.
- "normal_factor" (float): value to multiply the level count of normal (non-treasure) enchantments with. For example, if this is set to
- if "type" (string) is
"grindenchantments:average_count": divides the level cost returned by another cost function by the number of enchantments on the item (be aware that"grindenchantments:first_enchantment"will always reduce this to1, making it ineffective).- "function" (object): The cost function to delegate the initial level cost calculation to.
- if "type" (string) is
"grindenchantments:first_enchantment": removes all enchantments but the first from the item before passing the actual level cost calculation to another cost function.- "function" (object): The cost function to delegate the remaining level cost calculation to.
- if "type" (string) is
"grindenchantments:transform": changes the result of another cost function based on the formularesult = (cost * factor) + offset. The result is rounded up to the next integer.- "function" (object): The cost function to delegate the initial level cost calculation to.
- "factor" (float): the value to multiply the level cost with (default:
1.0). - "offset" (float): the value to add to the multiplied level cost (default:
0.0).
- if "type" (string) is
"grindenchantments:filter": applies the configured filter, to remove ignored enchantments. Should typically be the outermost cost function. Without this, ignored enchantments (which will remain on the original item) will still be taken into account for the level cost.- "function" (object): The cost function to delegate the remaining level cost calculation to.
- if "type" (string) is
Client
The client.json file contains some options that are exclusively used on the client side. Because the mod is compatible with vanilla clients, the only feature here is the display of the required XP cost.
- object: client config.
- "show_enchantment_cost" (boolean): can be used to stop showing the level cost on the client entirely. Levels will still be deducted when taking the resulting item, even if this is disabled (default:
true). - "sync_options" (object): controls the mod's config sync feature, where the server sends its config to any compatible client when connecting. This means that even if the
server.jsonfile on the phsyical client doesn't match the server's configuration, the displayed level costs will still be accurate.- "use_local_server_config_if_unsynced" (boolean): fall back to the local
server.jsonfile on the physical client in case the server does not send any configuration. If this is disabled, the client will not show a level cost on grindstone operations at all, even if it looks like one added by this mod. Should only be required for backwards compatibility with servers running old versions of the mod from before the config sync feature was added (default:true). - "log_received_config" (boolean): when receiving the server's configuration, log it in the console in JSON format. Useful for debugging, or if you're curious how the server is configured (default:
false).
- "use_local_server_config_if_unsynced" (boolean): fall back to the local
- "show_enchantment_cost" (boolean): can be used to stop showing the level cost on the client entirely. Levels will still be deducted when taking the resulting item, even if this is disabled (default: