Mods / Thrifty Smithing

Category: #Crafting #Tweak
Author: Foxcapades
Side: Both
Created: Aug 21st at 4:03 PM
Last modified: Oct 25th at 1:01 AM
Downloads: 4134
Follow Unfollow 124

Latest file for v1.19.8:
thrifty-smithing-1.2.0.zip 1-click install


Gives back scrap metal split off of items being crafted on an anvil.

Once a smithing work is completed, the player who completed it will be given the amount of whole bits that could be formed from the material removed from the work while it was being crafted.

If a smithing work is completed by a helve hammer, the scrap bits will be dropped to the floor at the base of the anvil.

Configuration

The following configuration options are provided in the thrifty-smithing.json file, with default values based on the base VintageStory experience. Most of these should not be changed unless necessitated by changes from other mods.

{
  "voxelsPerIngot": 42,
  "voxelsPerPlate": 81,
  "materialUnitsPerIngot": 100,
  "materialUnitsPerBit": 5,
  "materialUnitsRecoveredModifier": 1.0,
  "disallowedRecipes": []
}
Option Type Description

voxelsPerIngot

int

The number of voxels a single ingot should be worth.

Valid value range: [1..255]

voxelsPerPlate

int

The number of voxels a single metal plate should be worth.

Valid value range: [1..255]

materialUnitsPerIngot

int

The amount of material required to craft an ingot.

Valid value range: [1..65535]

materialUnitsPerBit

int

The amount of material represented by a single metal bit.

Valid value range: [1..255]

materialUnitsRecoveredModifier

float

Percentage multiplier used to modify the amount of scrap material returned on completion of a smithing work.

The default value of 1.0 represents 100%, a value of 0.75 would represent 75%, 0.5 for 50% and so on.

Valid value range: [0.0..1.0] (max precision of ~4 digits)

disallowedRecipes

array of string

Asset locations for recipes that should not reward any scrap on completion.

For example setting this to ["game:knifeblade-copper"] would mean that players are not given any scrap metal back when crafting a copper knife blade.

Programmatic Extensibility

ThriftySmithing currently offers a limited mechanism through which other mods may alter the inputs used by ThriftySmithing to calculate metal bits returned as scrap after smithing an item.

ThriftySmithing looks for ITreeAttribute instances in an anvil's work item (BlockEntityAnvil.WorkItemStack) attributes whose names are prefixed with the string ef:ts:workData:. These ITreeAttribute instances may contain sub-attribute integer values under the keys voxels, ingots, and/or plates which may contain positive or negative values that will be applied to the scrap bit calculation.

Scrap Calculation

ThriftySmithing calculates the amount of scrap metal to give back to a player based on the number of voxels removed from a smithing work.  By default this is determined by subtracting the number of voxels required by a recipe from the voxels granted based on the number of ingots or metal plates placed onto the anvil.

Example Extension

// Add a bunch of extra voxels to the scrap bit calculation
void SetThriftySmithingVoxels(BlockEntityAnvil anvil)
{
  anvil.WorkItemStack.Attributes["ef:ts:workData:myMod"] = new TreeAttribute
  {
    ["voxels"] = new IntAttribute(36),
  }
}

Attributes

Root Level (directly on the anvil's work item stack)
Key Type Notes

ef:ts:workData:*

ITreeAttribute

A tree attribute that may contain the sub-attributes voxels, ingots, plates.

 

Sub Attributes (under the root ITreeAttribute)
Key Type Notes

voxels

IntAttribute

A positive or negative value in the range [-128..127] that may be provided to add or subtract from the scrap voxels for a smithing recipe.

ingots

IntAttribute

A positive or negative value in the range [-128..127] that may be provided to add or subtract from the count of input ingots for a smithing recipe.

plates

IntAttribute

A positive or negative value in the range [-128..127] that may be provided to add or subtract from the count of input metal plates for a smithing recipe.

Compatibility

  • Thrifty Smithing should be compatible with mod-based smithing recipes that use base game materials.
  • Thrifty Smithing may be compatible with mod-based metals, assuming they provide metal bit items with asset locations matching the base game's metalbit-{material} scheme.
  • Thrifty Smithing is not likely compatible with mods that overhaul or make significant changes to the smithing system, especially with regard to anvils.
  • Thrifty Smithing is not compatible with mods that allow smithing items without the use of anvils at all (it shouldn't cause a problem, it just won't give back scrap without an anvil).

Known Compatibilities

💚 Smithing Plus v1.0.1+ Great together!
💚 Knapster v2.x.x No issues!
💚 Ancient Armory v1.x.x Works fine!
👾 Anvil Metal Recovery Might work but seems silly.

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v1.2.0 1975 Oct 25th at 1:01 AM Show thrifty-smithing-1.2.0.zip Install now
v1.1.0 1624 Aug 27th at 9:49 PM Show thrifty-smithing-1.1.0.zip Install now
v1.0.1 149 Aug 26th at 10:06 PM Show thrifty-smithing-1.0.1.zip Install now
v1.0.0 386 Aug 21st at 6:32 PM Show thrifty-smithing-1.0.0.zip Install now

20 Comments (oldest first | newest first)

💬 TrueMetis, Nov 17th at 9:34 AM

Found an interesting issue where the metal bits gotten from chiseling broken items from Smithing Plus and the metal bits returned from forging from Thrifty Smithing don't stack. They have the same name and look identical just don't stack.

When smelted down into ingots they turn into regular ingots, and you can even smelt different bits of the same metal type into a single ingot, with the weird exception of iron bits into the bloomery, you need to only use one of the stacks, but then the resulting iron ingots don't stack with normal iron ingots.

Posting this comment on both mods, cause I'm not sure where, or even what, exactly the issue is.

💬 Calamity, Nov 5th at 4:49 PM

metal recovery for iron bloom would be awesome!

💬 Topminator, Nov 1st at 9:52 PM

do you plan to add metal recovery for iron blooms and blister steel too?

💬 BlackBird90, Oct 30th at 6:46 AM

@Foxcapades Yes I also had Smithing Plus, I went back and disabled it and that fixed the bug. Thanks for the suggestion.
edit: It was Smithing Plus version 1.0.1.
edit 2: I installed the latest version Smithing Plus 1.1.1 and that fixed it.

💬 jayu, Oct 30th at 1:37 AM

Oh yeah the chiseling issue is something I faced too, I fixed it for work items like this, although you will probably have to harmony patch the base method of ItemNugget instead of overriding the nugget class with one that inherits like I do. I did forget to fix it for other items too.

💬 FoxcapadesAuthor, Oct 27th at 4:48 PM

Fazule, that is an oversight on my part.  I can add a toggleable feature to this mod to reduce the bits returned by chiseling metal items to an amount that makes sense given the metal that was actually used in the smithing recipe.

I do think it is a bit odd that the base game gives back the full input cost when chiselling a metal part in the first place.

💬 Fazule, Oct 27th at 8:31 AM

I found a bug with which you can dupe more metal. Smithing tin bronze chain consumed 2 ingots and returned 12 bits. You can then break the chain using chisel and get 40 bits. So you end up with 52 bits while starting just with 40 (2 ingots). This can be probably done on other smithed parts as well.

💬 FoxcapadesAuthor, Oct 26th at 2:40 AM

BlackBird90 do you have other smithing plugins enabled? I haven't been able to reproduce the issue myself, I get back 14 bits when putting in 2 iron ingots for 8 nails.

💬 BlackBird90, Oct 25th at 6:54 PM

Hi, great mod I really like the idea I found a bug in testing. Making 8x nails and strips out of iron gives back too much metal. Using 2 iron ingots gives back 22 bits of metal, the same recipee using 2 ingots of copper or tin bronze gives back the correct ammount of metal, 14 bits.

💬 jayu, Oct 24th at 1:25 AM

Hey, I made a mod that adds an additional use for the bits generated when using this mod. Very useful for steel bits: https://mods.vintagestory.at/smithingplus
Seems compatible from my testing (I just change nuggets to be workable and add code similar to the ingot to add it to existing work items).

Edit: Thanks for the help!

💬 Briccars, Aug 29th at 7:23 PM

Came here looking for the mod making my iron blooms disappear and found you already fixed it, great work!

💬 GodlyAnnihilator, Aug 27th at 3:38 PM

Thanks for the quick update! Really appreciate it! 

Foxcapades!

💬 FoxcapadesAuthor, Aug 27th at 1:26 AM

1stSlug, while it doesn't give back quite 100% for most recipes, it does presently try and get as close to 100% as it can, so having a general modifier like you suggest is a great idea! That will be going into the next update 👯

💬 1stSlug, Aug 27th at 12:48 AM

It really annoys me that base game wastes so much doubly so considering the effort we players have to go to find these resources, so this is a great mod! 💯

A possible mod branch could involve a config/setting where you only gain back 50-75%, or lower/high, of your waste instead off the full 100%. 🤔

💬 FoxcapadesAuthor, Aug 26th at 10:10 PM

Hunter118 GodlyAnnihilator

Thanks for the bug report!  I goofed up a string-splitting function, which threw an error for a handful of items, and had the end result you reported.  Should be resolved in v1.0.1

💬 GodlyAnnihilator, Aug 26th at 2:13 PM

Welp, I'm also having the same bug as Hunter118.

I tried going into Iron Age, and when I placed the bloom into the anvil it was invincible.

Disabled the mod and the bloom became visible again. 

💬 Hunter118, Aug 25th at 9:30 PM

Im having a bug that make iron blooms on anvils invisable and unworkable. Not sure if its just the mod or its conflicting with other mods, only that uninstalling it fixs the bug. Otherwise im quite injoying the mod. 

💬 GodlyAnnihilator, Aug 24th at 1:48 PM

Really cool mod. Some items need too little material and so much is lost, and it's frustrating, especially when that material is scarce.

This mod is totally worth it. No errors or mod compatibilities despite using a large amount of mods.

Great job Foxcapades

💬 FoxcapadesAuthor, Aug 21st at 9:17 PM

@NukoSan Effectively, yes.  AMR's smithing component does basically the same thing as this mod.  This mod does not presently return scrap for broken tools, so if that is a feature you want, AMR might be the way to go.

💬 NukoSan, Aug 21st at 8:39 PM

So either this mod or AMR?

(edit comment delete)