From 730195c47e39792c2dba57e3f5d4f929cc237bd4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 23 Oct 2013 11:12:04 +0200 Subject: Exported cHopperEntity to API. This allows hoppers to be created by plugins during chunk generation. --- source/AllToLua.pkg | 1 + source/Bindings.cpp | 173 ++++++++++++++++++++++++++++++++---- source/Bindings.h | 2 +- source/BlockEntities/HopperEntity.h | 2 +- 4 files changed, 157 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/AllToLua.pkg b/source/AllToLua.pkg index 00257e460..6d4a4083a 100644 --- a/source/AllToLua.pkg +++ b/source/AllToLua.pkg @@ -47,6 +47,7 @@ $cfile "BlockEntities/DropSpenserEntity.h" $cfile "BlockEntities/DispenserEntity.h" $cfile "BlockEntities/DropperEntity.h" $cfile "BlockEntities/FurnaceEntity.h" +$cfile "BlockEntities/HopperEntity.h" $cfile "WebAdmin.h" $cfile "WebPlugin.h" $cfile "Root.h" diff --git a/source/Bindings.cpp b/source/Bindings.cpp index eb9eae90d..1ab696275 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/23/13 11:04:39. +** Generated automatically by tolua++-1.0.92 on 10/23/13 11:08:31. */ #ifndef __cplusplus @@ -46,6 +46,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); #include "BlockEntities/DispenserEntity.h" #include "BlockEntities/DropperEntity.h" #include "BlockEntities/FurnaceEntity.h" +#include "BlockEntities/HopperEntity.h" #include "WebAdmin.h" #include "WebPlugin.h" #include "Root.h" @@ -74,9 +75,9 @@ static int tolua_collect_cItem (lua_State* tolua_S) return 0; } -static int tolua_collect_cFurnaceEntity (lua_State* tolua_S) +static int tolua_collect_Vector3f (lua_State* tolua_S) { - cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } @@ -144,9 +145,9 @@ static int tolua_collect_cPickup (lua_State* tolua_S) return 0; } -static int tolua_collect_sWebAdminPage (lua_State* tolua_S) +static int tolua_collect_cItems (lua_State* tolua_S) { - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } @@ -172,9 +173,16 @@ static int tolua_collect_cBoundingBox (lua_State* tolua_S) return 0; } -static int tolua_collect_Vector3f (lua_State* tolua_S) +static int tolua_collect_sWebAdminPage (lua_State* tolua_S) { - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cHopperEntity (lua_State* tolua_S) +{ + cHopperEntity* self = (cHopperEntity*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } @@ -186,16 +194,16 @@ static int tolua_collect_Vector3i (lua_State* tolua_S) return 0; } -static int tolua_collect_cIniFile (lua_State* tolua_S) +static int tolua_collect_cFurnaceEntity (lua_State* tolua_S) { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } -static int tolua_collect_cItems (lua_State* tolua_S) +static int tolua_collect_cIniFile (lua_State* tolua_S) { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } @@ -244,36 +252,37 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); tolua_usertype(tolua_S,"cLuaWindow"); tolua_usertype(tolua_S,"cInventory"); - tolua_usertype(tolua_S,"cBoundingBox"); + tolua_usertype(tolua_S,"cHopperEntity"); tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cWindow"); - tolua_usertype(tolua_S,"cGroup"); - tolua_usertype(tolua_S,"HTTPFormData"); + tolua_usertype(tolua_S,"cTracer"); tolua_usertype(tolua_S,"cCraftingGrid"); + tolua_usertype(tolua_S,"HTTPFormData"); + tolua_usertype(tolua_S,"HTTPRequest"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); tolua_usertype(tolua_S,"cBlockArea"); - tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cGroup"); + tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cStringMap"); tolua_usertype(tolua_S,"cServer"); - tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); + tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cFile"); tolua_usertype(tolua_S,"std::vector"); tolua_usertype(tolua_S,"cClientHandle"); tolua_usertype(tolua_S,"cChatColor"); tolua_usertype(tolua_S,"cWebPlugin"); - tolua_usertype(tolua_S,"cWebAdmin"); tolua_usertype(tolua_S,"cIniFile"); + tolua_usertype(tolua_S,"cWebAdmin"); tolua_usertype(tolua_S,"sWebAdminPage"); - tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cPawn"); tolua_usertype(tolua_S,"cPlayer"); tolua_usertype(tolua_S,"cGroupManager"); tolua_usertype(tolua_S,"cBlockEntityWindowOwner"); - tolua_usertype(tolua_S,"HTTPRequest"); + tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"cItemGrid::cListener"); tolua_usertype(tolua_S,"cDropperEntity"); @@ -18864,6 +18873,118 @@ static int tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: new of class cHopperEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cHopperEntity_new00 +static int tolua_AllToLua_cHopperEntity_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cHopperEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + { + cHopperEntity* tolua_ret = (cHopperEntity*) Mtolua_new((cHopperEntity)(a_BlockX,a_BlockY,a_BlockZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cHopperEntity"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cHopperEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cHopperEntity_new00_local +static int tolua_AllToLua_cHopperEntity_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cHopperEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + { + cHopperEntity* tolua_ret = (cHopperEntity*) Mtolua_new((cHopperEntity)(a_BlockX,a_BlockY,a_BlockZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cHopperEntity"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOutputBlockPos of class cHopperEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cHopperEntity_GetOutputBlockPos00 +static int tolua_AllToLua_cHopperEntity_GetOutputBlockPos00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cHopperEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cHopperEntity* self = (cHopperEntity*) tolua_tousertype(tolua_S,1,0); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,2,0)); + int a_OutputX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_OutputY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_OutputZ = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOutputBlockPos'", NULL); +#endif + { + bool tolua_ret = (bool) self->GetOutputBlockPos(a_BlockMeta,a_OutputX,a_OutputY,a_OutputZ); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushnumber(tolua_S,(lua_Number)a_OutputX); + tolua_pushnumber(tolua_S,(lua_Number)a_OutputY); + tolua_pushnumber(tolua_S,(lua_Number)a_OutputZ); + } + } + return 4; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOutputBlockPos'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* get function: Name of class HTTPFormData */ #ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Name static int tolua_get_HTTPFormData_Name(lua_State* tolua_S) @@ -30920,6 +31041,20 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetFuelBurnTimeLeft",tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00); tolua_function(tolua_S,"HasFuelTimeLeft",tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00); tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cHopperEntity","cHopperEntity","cBlockEntityWithItems",tolua_collect_cHopperEntity); + #else + tolua_cclass(tolua_S,"cHopperEntity","cHopperEntity","cBlockEntityWithItems",NULL); + #endif + tolua_beginmodule(tolua_S,"cHopperEntity"); + tolua_constant(tolua_S,"ContentsHeight",cHopperEntity::ContentsHeight); + tolua_constant(tolua_S,"ContentsWidth",cHopperEntity::ContentsWidth); + tolua_constant(tolua_S,"TICKS_PER_TRANSFER",cHopperEntity::TICKS_PER_TRANSFER); + tolua_function(tolua_S,"new",tolua_AllToLua_cHopperEntity_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cHopperEntity_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cHopperEntity_new00_local); + tolua_function(tolua_S,"GetOutputBlockPos",tolua_AllToLua_cHopperEntity_GetOutputBlockPos00); + tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"HTTPFormData","HTTPFormData","",NULL); tolua_beginmodule(tolua_S,"HTTPFormData"); tolua_variable(tolua_S,"Name",tolua_get_HTTPFormData_Name,tolua_set_HTTPFormData_Name); diff --git a/source/Bindings.h b/source/Bindings.h index 578779329..78a27292e 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/23/13 11:04:40. +** Generated automatically by tolua++-1.0.92 on 10/23/13 11:08:32. */ /* Exported function */ diff --git a/source/BlockEntities/HopperEntity.h b/source/BlockEntities/HopperEntity.h index a49868660..9e69f15c3 100644 --- a/source/BlockEntities/HopperEntity.h +++ b/source/BlockEntities/HopperEntity.h @@ -95,7 +95,7 @@ protected: /// Moves one piece to the specified entity's contents' slot. Returns true if contents have changed. bool MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstSlotNum); -} ; +} ; // tolua_export -- cgit v1.2.3