Jump to content

Recommended Posts

Posted

Is it possible to, for example, add recipe to the bloomery, using json files?

To get, for example, nickel bloom, with nickel ingot produced by smithing slag, similar to iron one?

Posted (edited)

Here is the code that is responsible for determining whether an item can be bloomed or not.

BlockEntityBloomery.cs

From what I can tell, it's a mix of collectible object attributes and smelting props.

The methods you'd want to take a close look at are "DoSmelt()", "CanAdd()" and "TryAdd()".

Edit: To answer your question, yes, it's totally possible to make bloomery "recipes" with content only. No code required.

Edited by Wondiws98
  • Thanks 1
Posted

This is exactly what I needed too! 

I'm trying to change the smelting temperature range, but I'm not where to place this file or format the code so it properly applies. Any tips?

 

Posted
13 hours ago, Wahazar said:

You need to search for meltingPoint - for example in assets/survival/resources/...

I was thinking of changing the smelting temperature range of the bloomery, not the items I want to be compatible with it.

I did find the line: "if (collectible.CombustibleProps?.SmeltedStack != null && collectible.CombustibleProps.MeltingPoint < 1500 && collectible.CombustibleProps.MeltingPoint >= 1000)" But changing the values didn't seem to do anything. So I assume I simply placed the file in the wrong spot or formatted the changes in code incorrectly.

Posted
Quote

So I assume I simply placed the file in the wrong spot or formatted the changes in code incorrectly.

Changing these lines would require a code mod, you cannot make changes to code using Jsons.

Posted
21 hours ago, Wondiws98 said:

Changing these lines would require a code mod, you cannot make changes to code using Jsons.

I kinda figured that'd be the case. Is there a way to patch existing code using a code mod?

Posted
1 hour ago, SevenIndex said:

I kinda figured that'd be the case. Is there a way to patch existing code using a code mod?

Yes! There are two ways you can override vanilla code behaviours.

The best way in terms of compatibility would be to use Harmony. It's takes a bit of time to learn how and figure out how to properly use it (at least it did for me) but when you get the hang of it, the sky's the limit!

The other way, although bad in terms of compatibility but much easier to achieve and limited to blocks, items, entities, etc. Is to simply create a new class that inherits the class of the thing you want to change the behaviour of, override the method you want to modify, and then register that class. You can then use a json patch to swap the class of the thing you want to change to your own customized class, in your case that would be would be "BlockEntityBloomery".

I don't recommend the second method unless you are really overhauling something and need change to most of the code.

It's also important to note that both these method would require some knowledge in c#. If you do want to get serious in making code mods for Vintage Story, this is where I think you should start.

Posted
2 hours ago, Wondiws98 said:

Yes! There are two ways you can override vanilla code behaviours.

The best way in terms of compatibility would be to use Harmony. It's takes a bit of time to learn how and figure out how to properly use it (at least it did for me) but when you get the hang of it, the sky's the limit!

The other way, although bad in terms of compatibility but much easier to achieve and limited to blocks, items, entities, etc. Is to simply create a new class that inherits the class of the thing you want to change the behaviour of, override the method you want to modify, and then register that class. You can then use a json patch to swap the class of the thing you want to change to your own customized class, in your case that would be would be "BlockEntityBloomery".

I don't recommend the second method unless you are really overhauling something and need change to most of the code.

It's also important to note that both these method would require some knowledge in c#. If you do want to get serious in making code mods for Vintage Story, this is where I think you should start.

Nice! Probably gonna go with the first method since the json patch swap seems liable to create more problems relative to what I intend to change.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.