Smithing should give durability bonuses (for tools that don't benefit from efficiently ones)
RiverC opened this issue ยท 6 comments
Describe the bug
Smithing skill is supposed to buff items, but for some items, such as smithing hammers, I'm unable to determine what buff they get, as the only possible buff would be durability and skill applied to the item doesn't affect max durability.
To Reproduce
Turn on advanced item details so you can see durability information on items. Smith two hammers from wrought iron. The later smithed hammer should have a higher percentage skill bonus. Use each hammer at least once; you will notice both have the same max durability: 2200.
*I have not tested with all items.
Meta Info
- TFC Version: MC1.12.2-0.27.7.107
Needs to be done via event handler on tool damage, similar to
for efficiency bonus, as modifying the damage is likely more difficult with max damage items. (Although it could be looked into.)
Classic gave buffs on durability, damage, and efficiency for everything except armor:
https://github.com/TerraFirmaCraft/TFC-1.7.10/blob/9979960a7c13c19e4e6d018aa774c8a707c85592/src/Common/com/bioxx/tfc/TileEntities/TEAnvil.java#L139
https://github.com/TerraFirmaCraft/TFC-1.7.10/blob/9979960a7c13c19e4e6d018aa774c8a707c85592/src/Common/com/bioxx/tfc/Items/Tools/ItemWeapon.java#L167
I would classify this as an un-implemented feature, if it makes sense to replicate this in TFC?
It's a bug; otherwise smithing skill has no purpose. (If smithing skill were not present, it would be unimplemented.)
Should add more info on this:
First: Can't add durability directly to other mods tools, minecraft's item durability is hardcoded to the Item
instance, which we can't control unless it's our own.
With that in mind, if we want to add bonus to the other mods tools, it must be done via forge events. There's no event for the damaging part, so, we must do some sort of work arounds. For breaking blocks I fixed by using two events: BlockEvent.BreakEvent
(called before the item receives damage) and BlockEvent.HarvestDropsEvent
(called after). But unfortunately there's no "ItemStack instance after receiving damage" for hitting entities or right clicking blocks (like using hoe, or creating paths), so, i can't stop tools receiving damage (like unbreaking enchant does) or add more durability (again, because it is hardcoded).
Lastly, if I, for example, remove one point of durability use (like repairing) to "emulate" that, if the tool is enchanted with unbreaking said tool would be instead regenerate durability creating an exploit mechanic.
ItemStack instance after receiving damage
yes there is, you can get the player's held item mainhand during HarvestDropsEvent
, and it will be the used item after taking damage (may be broken)