Silent Gear

Silent Gear

30M Downloads

How to add a material stat?

chris-wjn opened this issue ยท 7 comments

commented

This is just for author. Wondering how it would be possible for me to add new stats to materials. Not change their values, but actually add new stats. I'm developing a mod that adds extra damage types to the game, like slash, fire, lightning, etc... I want to integrate it with SilentGear, but I'm not sure how material stats work in the code.

commented

Currently it's not possible to add stats to existing materials. It really is something I need to add. You can already register new stats at least.

If you have any proposals on how giving stats to existing materials should be handled, let me know.

commented

Is there an easy way to get the materials a tool is made of? I use capabilities to store all my extra damage types and resistances, so maybe there's a way to just artificially add it by checking what a tool is made of and giving it capabilities.

commented

Yes, all of that information is in NBT. You could use GearApi.getMainPart to get the head/blade part, then get the material list from that.

commented

Hi, just a quick question to do with datapacks. I need to overwrite a few of your traits and materials, which I'm doing with datapacks obviously. If I include the overwrite json files in my mod's data folder, under data/silentgear/silentgear_traits and data/silentgear/silentgear_materials, will this overwrite the base files automatically? Or do I have to ensure my mod loads after SilentGear?

commented

Hmm... I'm honestly not sure if mod load order has any impact on the loading of resources.

commented

You're right, vanilla just hard codes the value. The bow item is what assigns the damage to the arrow when fired. My bows have rewritten code that checks for the stat. The code for bows is here. Crossbows and slingshots should have a similar line.

commented

Sorry to bother you so much, but how do you implement ranged damage from bows? From what I've seen, vanilla bows and crossbows don't have any sort of damage stat, so how do you get the bow an arrow was shot from to calculate extra damage stats?