Blacksmith icon

Blacksmith -----

Adds Blacksmith and Scrapper traits to Citizens NPCs



Blacksmith

The blacksmith plugin adds a blacksmith trait and a scrapper trait to Citizens NPCs. Blacksmith NPCs are able to repair a player's held item for a fee. Costs are highly customizable. Scrapper NPCs can break down items into their crafting recipe.

This was forked from the original and outdated project by aPunch, jrbudda and HurricanKai.

Important changes from the original fork:
  • The problem with armor being unrepairable because the player would equip it instead has been fixed.
  • A lot of configuration value have had their paths altered, so configurations need to be updated.
  • By default, natural cost is used. The original fork made it cheaper the more damaged an item is, but natural cost makes the cost increase the more damaged the item is.
  • EnchantmentTarget is used instead of a hard-coded list of repairable items
  • All settings, both global and for each blacksmith / scrapper, can be changed using commands, and support tab-completion.
  • This plugin is not directly compatible with the original. If you are using the old one, you will need to set it up again!

Dependencies
  • Citizens2
  • Vault
  • Any Vault-supported Economy plugin

Extensions



Basic usage

To create a new blacksmith, simply add the blacksmith trait to an NPC by selecting it with /npc select, and then using /trait add Blacksmith (See Citizens' documentation for more details).

To create a new scrapper, simply add the scrapper trait to an NPC by selecting it with /npc select, and then using /trait add Scrapper (See Citizens' documentation for more details).

Right-clicking the NPC will tell you if the currently held item is repairable by the blacksmith / salvageable by the scrapper. If it is, the blacksmith / scrapper should give a price quote. Right-clicking again starts the repair / salvage. The item should be given back or dropped after a random delay according to the set limits.

While costs are always set globally (no blacksmith or scrapper can do the same job for cheaper), the blacksmith / scrapper's messages, cool-down between each reforge / salvage, whether the item is dropped or given, the chance of failing or adding an enchantment, the maximum number of added enchantments, max and min delays, the length of the cool-down and which items the blacksmith is able to reforge / salvage can be changed individually.

Also note: As a change from the original plugin, unless a value for an NPC has been explicitly set for that NPC, it will mirror the values set in config.yml. This also means that configuration values aren't populated automatically in citizen's NPC save file. While you can manually set the values using the same keys as in config.yml, you should use the /blacksmith or /scrapper command when possible.

Non-standard functionality
There is some non-standard optional functionality for blacksmiths and scrappers that goes beyond repairing things with durability. They can all be enabled or disabled using configuration values.

  • Blacksmiths can repair anvils if the option reforgeAnvils is enabled
  • Scrappers can remove armor trim from items if salvageArmorTrims is enabled. This will always be done before salvaging the item itself. If not enabled, the item is considered un-salvageable.
  • Scrappers can remove netherite from items if salvageNetherite is enabled. This will be done if no armor trim exists, before normal salvage. If not enabled, the item is considered un-salvageable.
  • Scrappers can salvage enchanted items, and return some XP based on the enchantment set if salvageEnchanted is enabled. If not enabled, the item is considered un-salvageable.
  • Scrappers can salvage just about anything with a crafting table recipe if extendedSalvageEnabled is enabled. As long as you have the amount of items produced by a crafting recipe, you can undo the recipe. Four planks can be salvaged into a log as an example.

Special behavior
In addition to just being able to repair items, blacksmiths / scrappers have some random features which can be cool or annoying:

  • There is a chance that blacksmiths / scrappers fail to repair an item, leaving it at about the same durability as before (scrappers with extendedSalvageEnabled turned on might cause items in a stack to be lost). Use failReforgeChance to control the chance. Set it to 0 to remove the feature.
  • There is a chance a blacksmith may add an enchantment to a reforged item. You can control the probability using extraEnchantmentChance, and set the maximum number of enchantments using maxEnchantments. EnchantmentBlockList can be used to block any enchantments you don't want to randomly grant.

Scrapper basics
A scrapper will produce salvage for a damage-able item by calculating the amount of items returned based on items in the recipe, and the percentage of durability left on the item. To avoid returning relatively worthless items instead of valuable items, trashSalvage can be configured. Trash salvage will only be returned if all non-trash items are returned as well. A scrapper will by default only salvage damage-able items (same as blacksmiths), but enabling extendedSalvageEnabled for a scrapper will allow it to salvage any crafting table recipe. Note that to salvage for example planks into wood, four wood will be taken.

When an item is salvaged, EXP will be returned based on enchantments on the item.

Note that sticks are valid items to be handled by Scrappers if extended salvage is enabled. The item is also the default item for selecting NPCs in Citizens. If you find the NPC selection message annoying, and don't normally use sticks for selection, you can change the item in Citizens' config and replace it with STRUCTURE_VOID or some other unobtainable item.

See the documentation tab for documentation about setup and configuration. Or check out the README!

License

Blacksmith is licensed under the GNU Public License Version 3.0. This includes every source and resource file.
Resource Information
Author:
----------
Total Downloads: 483
First Release: Oct 26, 2022
Last Update: Aug 7, 2024
Category: ---------------
All-Time Rating:
3 ratings
Find more info at git.knarcraft.net...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings