TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Smithing should give durability bonuses (for tools that don't benefit from efficiently ones)

RiverC opened this issue ยท 6 comments

commented

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
commented

Needs to be done via event handler on tool damage, similar to

public static void onBreakProgressEvent(BreakSpeed event)

for efficiency bonus, as modifying the damage is likely more difficult with max damage items. (Although it could be looked into.)

commented

It's a bug; otherwise smithing skill has no purpose. (If smithing skill were not present, it would be unimplemented.)

commented

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.

commented

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)

commented

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)

not for hitting entitities or right clicking blocks. HarvestDropsEvent is already covered in that commit for breaking blocks.