06-13-2012, 05:26 PM
Currently MCServer doesn't have built-in support for repairing items. But with the current addition of crafting hooks, it is possible to implement repairing items in plugins. Any plugin author brave enough to try?

Item repair
|
06-13-2012, 05:26 PM
Currently MCServer doesn't have built-in support for repairing items. But with the current addition of crafting hooks, it is possible to implement repairing items in plugins. Any plugin author brave enough to try?
![]()
06-14-2012, 04:01 AM
Trying to figure out the best way to do it:
1. Use HOOK_PRE_CRAFTING to determinate which objects are in grid, if there are two of same kind (and nothing else) - set output item and health manually? 2. Use HOOK_PRE_CRAFTING, but add recipe in crafting.txt (will it count damaged items as well?) instead of manual parsing and set output health only? (because output item will be set in recipe) Also: should I change output health in HOOK_POST_CRAFTING as well?
I think you should use HOOK_CRAFTING_NO_RECIPE, because that way no unnecessary hooks are called.
Figure out whether there are two of the same items (and only those two) in the crafting grid. Then use the ItemCategory:IsTool( ItemID ) function to determine it's a tool Then set the output item to have the ID of the input items, but with less damage (use the damage formula thingy)
06-14-2012, 04:31 AM
I'm not sure if ItemCategory:IsTool() is accessable in Lua, I'll test it right now...
Could we have IsArmor as well?
06-14-2012, 04:46 AM
I just exported all the ItemCategory functions, and added the IsTool function. I could also add armor functions yea
06-15-2012, 01:59 AM
06-15-2012, 03:03 AM
Nice
![]() ![]() |
« Next Oldest | Next Newest »
|