summaryrefslogtreecommitdiffstats
path: root/source/ManualBindings.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-22 12:26:06 +0100
committermadmaxoft <github@xoft.cz>2013-11-22 12:26:06 +0100
commit3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136 (patch)
tree2582c6cad06ccec827e1c7af9e86a1e61fb3b700 /source/ManualBindings.cpp
parentAPIDump: Documented cPlayer XP-related functions. (diff)
downloadcuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar.gz
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar.bz2
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar.lz
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar.xz
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.tar.zst
cuberite-3de6f6357f3e4c2b0b696e2a0b6cdbdaecdf4136.zip
Diffstat (limited to 'source/ManualBindings.cpp')
-rw-r--r--source/ManualBindings.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index 59bd0657c..418819910 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -2063,6 +2063,45 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S)
+static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ if (
+ !L.CheckParamUserType(1, "const cItem") ||
+ !L.CheckParamEnd (2)
+ )
+ {
+ return 0;
+ }
+
+ // Check the input param:
+ cItem * Input = (cItem *)tolua_tousertype(L, 1, NULL);
+ if (Input == NULL)
+ {
+ LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing.");
+ return 0;
+ }
+
+ // Get the recipe for the input
+ cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
+ const cFurnaceRecipe::Recipe * Recipe = FR->GetRecipeFrom(*Input);
+ if (Recipe == NULL)
+ {
+ // There is no such furnace recipe for this input, return no value
+ return 0;
+ }
+
+ // Push the output, number of ticks and input as the three return values:
+ tolua_pushusertype(L, Recipe->Out, "const cItem");
+ tolua_pushnumber (L, (lua_Number)(Recipe->CookTime));
+ tolua_pushusertype(L, Recipe->In, "const cItem");
+ return 3;
+}
+
+
+
+
+
static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
{
// function cHopperEntity::GetOutputBlockPos()
@@ -2125,6 +2164,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith <cRoot, cPlayer, &cRoot::FindAndDoWithPlayer>);
tolua_function(tolua_S, "ForEachPlayer", tolua_ForEach<cRoot, cPlayer, &cRoot::ForEachPlayer>);
tolua_function(tolua_S, "ForEachWorld", tolua_ForEach<cRoot, cWorld, &cRoot::ForEachWorld>);
+ tolua_function(tolua_S, "GetFurnaceRecipe", tolua_cRoot_GetFurnaceRecipe);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cWorld");