10-22-2014, 06:11 PM
Sorry for the late reply. Yes, most of the API objects that contain arrays use 0-based indices, because the API is shared between C++ and Lua and is primarily C++.
Custom recipes are not implemented by "force-feeding" them to the server, but quite the opposite - the server asks each time a player changes the crafting grid, and a plugin may override the result of such crafting. So you need to use the HOOK_PRE_CRAFTING hook, and in it check the contents of the crafting grid (2nd param) against your recipe. If it matches, then modify the received Recipe object (3rd param) with your actual recipe and result. Note that you can use item counts in the recipe, and if the player uses such a recipe, the specified amount of items will be used out of the crafting grid (so you can actually make a recipe that takes 3 planks out of one slot for a single result).
Custom recipes are not implemented by "force-feeding" them to the server, but quite the opposite - the server asks each time a player changes the crafting grid, and a plugin may override the result of such crafting. So you need to use the HOOK_PRE_CRAFTING hook, and in it check the contents of the crafting grid (2nd param) against your recipe. If it matches, then modify the received Recipe object (3rd param) with your actual recipe and result. Note that you can use item counts in the recipe, and if the player uses such a recipe, the specified amount of items will be used out of the crafting grid (so you can actually make a recipe that takes 3 planks out of one slot for a single result).