Artisan Worktables 1.12

Artisan Worktables 1.12

3M Downloads

Support returning custom ItemStack from IToolHandler.applyDamage()

copygirl opened this issue ยท 0 comments

commented

I would like to create tools usable in Artisan Worktables that turn into a different item when completely used up, instead of breaking. In this case, buckets of clay that have a certain amount of uses before they turn into empty buckets again, which are a different Item altogether.

As such I think that it would be nice if IToolHandler.applyDamage() did not just pass an ItemStack as argument which only allows modifying damage and amount, but would actually allow returning a completely new ItemStack that represents the item after it was used.

  • The simulate parameter could be dropped, since simulation can be done by just ignoring the result of the method. It should be made clear in the API that the input ItemStack must not be modified.
  • The restrictDurability config setting should be made available in canAcceptAllDamage() and handled by that method, as there might otherwise be ways to duplicate resources as I've outlined in this comment with the uses I have in mind.
  • Automation might have to account for this, perhaps realizing that the tool, after being used, is not valid for the recipe anymore, spitting it out somewhere, allowing another valid tool to replace it?

(Related: #239)