From ebb2ccaa267116106002f358e18c5af58e13ec34 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 09:36:43 +0100
Subject: Removed BlockEntities' constructors from the API.
Plugins shouldn't construct block entities, rather, they will query them either from the cWorld (while playing), or from cChunkDesc (while generating).
---
source/Bindings.cpp | 564 ++-----------------------------
source/Bindings.h | 2 +-
source/BlockEntities/ChestEntity.cpp | 10 -
source/BlockEntities/ChestEntity.h | 4 -
source/BlockEntities/DispenserEntity.cpp | 10 -
source/BlockEntities/DispenserEntity.h | 3 -
source/BlockEntities/DropperEntity.cpp | 10 -
source/BlockEntities/DropperEntity.h | 3 -
source/BlockEntities/FurnaceEntity.cpp | 23 +-
source/BlockEntities/FurnaceEntity.h | 3 -
source/BlockEntities/HopperEntity.cpp | 11 -
source/BlockEntities/HopperEntity.h | 3 -
source/BlockEntities/SignEntity.cpp | 9 -
source/BlockEntities/SignEntity.h | 5 +-
14 files changed, 30 insertions(+), 630 deletions(-)
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index c7f6ada19..583bbfeb7 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/14/13 17:13:46.
+** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:12.
*/
#ifndef __cplusplus
@@ -70,79 +70,37 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
/* function to release collected object via destructor */
#ifdef __cplusplus
-static int tolua_collect_cItem (lua_State* tolua_S)
-{
- cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cFurnaceEntity (lua_State* tolua_S)
-{
- cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cChestEntity (lua_State* tolua_S)
-{
- cChestEntity* self = (cChestEntity*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cDispenserEntity (lua_State* tolua_S)
-{
- cDispenserEntity* self = (cDispenserEntity*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cCuboid (lua_State* tolua_S)
-{
- cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cBlockEntity (lua_State* tolua_S)
-{
- cBlockEntity* self = (cBlockEntity*) tolua_tousertype(tolua_S,1,0);
- Mtolua_delete(self);
- return 0;
-}
-
-static int tolua_collect_cBlockArea (lua_State* tolua_S)
+static int tolua_collect_sWebAdminPage (lua_State* tolua_S)
{
- cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cEnchantments (lua_State* tolua_S)
+static int tolua_collect_cBoundingBox (lua_State* tolua_S)
{
- cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0);
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cLuaWindow (lua_State* tolua_S)
+static int tolua_collect_cItem (lua_State* tolua_S)
{
- cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0);
+ cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cCraftingGrid (lua_State* tolua_S)
+static int tolua_collect_Vector3f (lua_State* tolua_S)
{
- cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0);
+ Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cDropperEntity (lua_State* tolua_S)
+static int tolua_collect_cIniFile (lua_State* tolua_S)
{
- cDropperEntity* self = (cDropperEntity*) tolua_tousertype(tolua_S,1,0);
+ cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
@@ -154,44 +112,44 @@ 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;
}
-static int tolua_collect_cTracer (lua_State* tolua_S)
+static int tolua_collect_cBlockArea (lua_State* tolua_S)
{
- cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0);
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cBoundingBox (lua_State* tolua_S)
+static int tolua_collect_cTracer (lua_State* tolua_S)
{
- cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cHopperEntity (lua_State* tolua_S)
+static int tolua_collect_cCraftingGrid (lua_State* tolua_S)
{
- cHopperEntity* self = (cHopperEntity*) tolua_tousertype(tolua_S,1,0);
+ cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_Vector3f (lua_State* tolua_S)
+static int tolua_collect_cCuboid (lua_State* tolua_S)
{
- Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0);
+ cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cIniFile (lua_State* tolua_S)
+static int tolua_collect_cBlockEntity (lua_State* tolua_S)
{
- cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0);
+ cBlockEntity* self = (cBlockEntity*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
@@ -203,16 +161,16 @@ static int tolua_collect_Vector3i (lua_State* tolua_S)
return 0;
}
-static int tolua_collect_cItems (lua_State* tolua_S)
+static int tolua_collect_cEnchantments (lua_State* tolua_S)
{
- cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
+ cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
-static int tolua_collect_cSignEntity (lua_State* tolua_S)
+static int tolua_collect_cLuaWindow (lua_State* tolua_S)
{
- cSignEntity* self = (cSignEntity*) tolua_tousertype(tolua_S,1,0);
+ cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
@@ -18112,75 +18070,6 @@ static int tolua_AllToLua_cBlockEntityWithItems_GetContents00(lua_State* tolua_S
}
#endif //#ifndef TOLUA_DISABLE
-/* method: new of class cChestEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cChestEntity_new00
-static int tolua_AllToLua_cChestEntity_new00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cChestEntity",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));
- {
- cChestEntity* tolua_ret = (cChestEntity*) Mtolua_new((cChestEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cChestEntity");
- }
- }
- 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 cChestEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cChestEntity_new00_local
-static int tolua_AllToLua_cChestEntity_new00_local(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cChestEntity",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));
- {
- cChestEntity* tolua_ret = (cChestEntity*) Mtolua_new((cChestEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cChestEntity");
- 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: AddDropSpenserDir of class cDropSpenserEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00
static int tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00(lua_State* tolua_S)
@@ -18287,221 +18176,6 @@ static int tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00(lua_State* tolua
}
#endif //#ifndef TOLUA_DISABLE
-/* method: new of class cDispenserEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cDispenserEntity_new00
-static int tolua_AllToLua_cDispenserEntity_new00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cDispenserEntity",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));
- {
- cDispenserEntity* tolua_ret = (cDispenserEntity*) Mtolua_new((cDispenserEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cDispenserEntity");
- }
- }
- 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 cDispenserEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cDispenserEntity_new00_local
-static int tolua_AllToLua_cDispenserEntity_new00_local(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cDispenserEntity",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));
- {
- cDispenserEntity* tolua_ret = (cDispenserEntity*) Mtolua_new((cDispenserEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cDispenserEntity");
- 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: new of class cDropperEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropperEntity_new00
-static int tolua_AllToLua_cDropperEntity_new00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cDropperEntity",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));
- {
- cDropperEntity* tolua_ret = (cDropperEntity*) Mtolua_new((cDropperEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cDropperEntity");
- }
- }
- 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 cDropperEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropperEntity_new00_local
-static int tolua_AllToLua_cDropperEntity_new00_local(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cDropperEntity",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));
- {
- cDropperEntity* tolua_ret = (cDropperEntity*) Mtolua_new((cDropperEntity)(a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cDropperEntity");
- 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: new of class cFurnaceEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_new00
-static int tolua_AllToLua_cFurnaceEntity_new00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cFurnaceEntity",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_isnumber(tolua_S,6,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,7,&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));
- unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0));
- unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0));
- {
- cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cFurnaceEntity");
- }
- }
- 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 cFurnaceEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_new00_local
-static int tolua_AllToLua_cFurnaceEntity_new00_local(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cFurnaceEntity",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_isnumber(tolua_S,6,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,7,&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));
- unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0));
- unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0));
- {
- cFurnaceEntity* tolua_ret = (cFurnaceEntity*) Mtolua_new((cFurnaceEntity)(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cFurnaceEntity");
- 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: GetInputSlot of class cFurnaceEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetInputSlot00
static int tolua_AllToLua_cFurnaceEntity_GetInputSlot00(lua_State* tolua_S)
@@ -18825,75 +18499,6 @@ 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: GetRecord of class cJukeboxEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_GetRecord00
static int tolua_AllToLua_cJukeboxEntity_GetRecord00(lua_State* tolua_S)
@@ -19148,79 +18753,6 @@ static int tolua_AllToLua_cNoteEntity_MakeSound00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: new of class cSignEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_new00
-static int tolua_AllToLua_cSignEntity_new00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cSignEntity",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
- {
- unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0));
- int a_BlockX = ((int) tolua_tonumber(tolua_S,3,0));
- int a_BlockY = ((int) tolua_tonumber(tolua_S,4,0));
- int a_BlockZ = ((int) tolua_tonumber(tolua_S,5,0));
- {
- cSignEntity* tolua_ret = (cSignEntity*) Mtolua_new((cSignEntity)(a_BlockType,a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cSignEntity");
- }
- }
- 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 cSignEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_new00_local
-static int tolua_AllToLua_cSignEntity_new00_local(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cSignEntity",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
- {
- unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0));
- int a_BlockX = ((int) tolua_tonumber(tolua_S,3,0));
- int a_BlockY = ((int) tolua_tonumber(tolua_S,4,0));
- int a_BlockZ = ((int) tolua_tonumber(tolua_S,5,0));
- {
- cSignEntity* tolua_ret = (cSignEntity*) Mtolua_new((cSignEntity)(a_BlockType,a_BlockX,a_BlockY,a_BlockZ));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cSignEntity");
- 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: SetLines of class cSignEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_SetLines00
static int tolua_AllToLua_cSignEntity_SetLines00(lua_State* tolua_S)
@@ -31419,17 +30951,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cBlockEntityWithItems_SetSlot01);
tolua_function(tolua_S,"GetContents",tolua_AllToLua_cBlockEntityWithItems_GetContents00);
tolua_endmodule(tolua_S);
- #ifdef __cplusplus
- tolua_cclass(tolua_S,"cChestEntity","cChestEntity","cBlockEntityWithItems",tolua_collect_cChestEntity);
- #else
tolua_cclass(tolua_S,"cChestEntity","cChestEntity","cBlockEntityWithItems",NULL);
- #endif
tolua_beginmodule(tolua_S,"cChestEntity");
tolua_constant(tolua_S,"ContentsHeight",cChestEntity::ContentsHeight);
tolua_constant(tolua_S,"ContentsWidth",cChestEntity::ContentsWidth);
- tolua_function(tolua_S,"new",tolua_AllToLua_cChestEntity_new00);
- tolua_function(tolua_S,"new_local",tolua_AllToLua_cChestEntity_new00_local);
- tolua_function(tolua_S,".call",tolua_AllToLua_cChestEntity_new00_local);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cDropSpenserEntity","cDropSpenserEntity","cBlockEntityWithItems",NULL);
tolua_beginmodule(tolua_S,"cDropSpenserEntity");
@@ -31439,40 +30964,19 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"Activate",tolua_AllToLua_cDropSpenserEntity_Activate00);
tolua_function(tolua_S,"SetRedstonePower",tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00);
tolua_endmodule(tolua_S);
- #ifdef __cplusplus
- tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",tolua_collect_cDispenserEntity);
- #else
tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",NULL);
- #endif
tolua_beginmodule(tolua_S,"cDispenserEntity");
- tolua_function(tolua_S,"new",tolua_AllToLua_cDispenserEntity_new00);
- tolua_function(tolua_S,"new_local",tolua_AllToLua_cDispenserEntity_new00_local);
- tolua_function(tolua_S,".call",tolua_AllToLua_cDispenserEntity_new00_local);
tolua_endmodule(tolua_S);
- #ifdef __cplusplus
- tolua_cclass(tolua_S,"cDropperEntity","cDropperEntity","cDropSpenserEntity",tolua_collect_cDropperEntity);
- #else
tolua_cclass(tolua_S,"cDropperEntity","cDropperEntity","cDropSpenserEntity",NULL);
- #endif
tolua_beginmodule(tolua_S,"cDropperEntity");
- tolua_function(tolua_S,"new",tolua_AllToLua_cDropperEntity_new00);
- tolua_function(tolua_S,"new_local",tolua_AllToLua_cDropperEntity_new00_local);
- tolua_function(tolua_S,".call",tolua_AllToLua_cDropperEntity_new00_local);
tolua_endmodule(tolua_S);
- #ifdef __cplusplus
- tolua_cclass(tolua_S,"cFurnaceEntity","cFurnaceEntity","cBlockEntityWithItems",tolua_collect_cFurnaceEntity);
- #else
tolua_cclass(tolua_S,"cFurnaceEntity","cFurnaceEntity","cBlockEntityWithItems",NULL);
- #endif
tolua_beginmodule(tolua_S,"cFurnaceEntity");
tolua_constant(tolua_S,"fsInput",cFurnaceEntity::fsInput);
tolua_constant(tolua_S,"fsFuel",cFurnaceEntity::fsFuel);
tolua_constant(tolua_S,"fsOutput",cFurnaceEntity::fsOutput);
tolua_constant(tolua_S,"ContentsWidth",cFurnaceEntity::ContentsWidth);
tolua_constant(tolua_S,"ContentsHeight",cFurnaceEntity::ContentsHeight);
- tolua_function(tolua_S,"new",tolua_AllToLua_cFurnaceEntity_new00);
- tolua_function(tolua_S,"new_local",tolua_AllToLua_cFurnaceEntity_new00_local);
- tolua_function(tolua_S,".call",tolua_AllToLua_cFurnaceEntity_new00_local);
tolua_function(tolua_S,"GetInputSlot",tolua_AllToLua_cFurnaceEntity_GetInputSlot00);
tolua_function(tolua_S,"GetFuelSlot",tolua_AllToLua_cFurnaceEntity_GetFuelSlot00);
tolua_function(tolua_S,"GetOutputSlot",tolua_AllToLua_cFurnaceEntity_GetOutputSlot00);
@@ -31484,18 +30988,11 @@ 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_endmodule(tolua_S);
tolua_cclass(tolua_S,"cJukeboxEntity","cJukeboxEntity","cBlockEntity",NULL);
tolua_beginmodule(tolua_S,"cJukeboxEntity");
@@ -31511,15 +31008,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IncrementPitch",tolua_AllToLua_cNoteEntity_IncrementPitch00);
tolua_function(tolua_S,"MakeSound",tolua_AllToLua_cNoteEntity_MakeSound00);
tolua_endmodule(tolua_S);
- #ifdef __cplusplus
- tolua_cclass(tolua_S,"cSignEntity","cSignEntity","cBlockEntity",tolua_collect_cSignEntity);
- #else
tolua_cclass(tolua_S,"cSignEntity","cSignEntity","cBlockEntity",NULL);
- #endif
tolua_beginmodule(tolua_S,"cSignEntity");
- tolua_function(tolua_S,"new",tolua_AllToLua_cSignEntity_new00);
- tolua_function(tolua_S,"new_local",tolua_AllToLua_cSignEntity_new00_local);
- tolua_function(tolua_S,".call",tolua_AllToLua_cSignEntity_new00_local);
tolua_function(tolua_S,"SetLines",tolua_AllToLua_cSignEntity_SetLines00);
tolua_function(tolua_S,"SetLine",tolua_AllToLua_cSignEntity_SetLine00);
tolua_function(tolua_S,"GetLine",tolua_AllToLua_cSignEntity_GetLine00);
diff --git a/source/Bindings.h b/source/Bindings.h
index eb6c566a7..a853b3521 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/14/13 17:13:47.
+** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:13.
*/
/* Exported function */
diff --git a/source/BlockEntities/ChestEntity.cpp b/source/BlockEntities/ChestEntity.cpp
index 59193829d..ca2626bc9 100644
--- a/source/BlockEntities/ChestEntity.cpp
+++ b/source/BlockEntities/ChestEntity.cpp
@@ -11,16 +11,6 @@
-cChestEntity::cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
- super(E_BLOCK_CHEST, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, NULL)
-{
- cBlockEntityWindowOwner::SetBlockEntity(this);
-}
-
-
-
-
-
cChestEntity::cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_CHEST, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World)
{
diff --git a/source/BlockEntities/ChestEntity.h b/source/BlockEntities/ChestEntity.h
index c6676894f..4f2c21e91 100644
--- a/source/BlockEntities/ChestEntity.h
+++ b/source/BlockEntities/ChestEntity.h
@@ -34,10 +34,6 @@ public:
ContentsWidth = 9,
} ;
-
- /// Constructor used while generating a chunk; sets m_World to NULL
- cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
-
// tolua_end
/// Constructor used for normal operation
diff --git a/source/BlockEntities/DispenserEntity.cpp b/source/BlockEntities/DispenserEntity.cpp
index 7edaa8a14..374f3d6e3 100644
--- a/source/BlockEntities/DispenserEntity.cpp
+++ b/source/BlockEntities/DispenserEntity.cpp
@@ -10,16 +10,6 @@
-cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
- super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, NULL)
-{
- SetBlockEntity(this); // cBlockEntityWindowOwner
-}
-
-
-
-
-
cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, a_World)
{
diff --git a/source/BlockEntities/DispenserEntity.h b/source/BlockEntities/DispenserEntity.h
index 5e3327f18..fdfe4e5b4 100644
--- a/source/BlockEntities/DispenserEntity.h
+++ b/source/BlockEntities/DispenserEntity.h
@@ -15,9 +15,6 @@ class cDispenserEntity :
public:
- /// Constructor used while generating a chunk; sets m_World to NULL
- cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
-
// tolua_end
/// Constructor used for normal operation
diff --git a/source/BlockEntities/DropperEntity.cpp b/source/BlockEntities/DropperEntity.cpp
index 61127cec1..5d4a8ad97 100644
--- a/source/BlockEntities/DropperEntity.cpp
+++ b/source/BlockEntities/DropperEntity.cpp
@@ -12,16 +12,6 @@
-cDropperEntity::cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
- super(E_BLOCK_DROPPER, a_BlockX, a_BlockY, a_BlockZ, NULL)
-{
- SetBlockEntity(this); // cBlockEntityWindowOwner
-}
-
-
-
-
-
cDropperEntity::cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_DROPPER, a_BlockX, a_BlockY, a_BlockZ, a_World)
{
diff --git a/source/BlockEntities/DropperEntity.h b/source/BlockEntities/DropperEntity.h
index af74e7f7c..8e07bc6f8 100644
--- a/source/BlockEntities/DropperEntity.h
+++ b/source/BlockEntities/DropperEntity.h
@@ -23,9 +23,6 @@ class cDropperEntity :
public:
- /// Constructor used while generating a chunk; sets m_World to NULL
- cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
-
// tolua_end
/// Constructor used for normal operation
diff --git a/source/BlockEntities/FurnaceEntity.cpp b/source/BlockEntities/FurnaceEntity.cpp
index 2f548d003..ec5ebe8b9 100644
--- a/source/BlockEntities/FurnaceEntity.cpp
+++ b/source/BlockEntities/FurnaceEntity.cpp
@@ -23,27 +23,6 @@ enum
-cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
- super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, NULL),
- m_BlockType(a_BlockType),
- m_BlockMeta(a_BlockMeta),
- m_CurrentRecipe(NULL),
- m_IsCooking(false),
- m_NeedCookTime(0),
- m_TimeCooked(0),
- m_FuelBurnTime(0),
- m_TimeBurned(0),
- m_LastProgressFuel(0),
- m_LastProgressCook(0)
-{
- SetBlockEntity(this); // cBlockEntityWindowOwner
- m_Contents.AddListener(*this);
-}
-
-
-
-
-
cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) :
super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
m_BlockType(a_BlockType),
@@ -57,7 +36,7 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY
m_LastProgressFuel(0),
m_LastProgressCook(0)
{
- SetBlockEntity(this); // cBlockEntityWindowOwner
+ cBlockEntityWindowOwner::SetBlockEntity(this);
m_Contents.AddListener(*this);
}
diff --git a/source/BlockEntities/FurnaceEntity.h b/source/BlockEntities/FurnaceEntity.h
index 038f60600..9464fd175 100644
--- a/source/BlockEntities/FurnaceEntity.h
+++ b/source/BlockEntities/FurnaceEntity.h
@@ -39,9 +39,6 @@ public:
ContentsHeight = 1,
};
- /// Constructor used while generating a chunk; sets m_World to NULL
- cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
-
// tolua_end
/// Constructor used for normal operation
diff --git a/source/BlockEntities/HopperEntity.cpp b/source/BlockEntities/HopperEntity.cpp
index c3d7ed3ba..41849b1b3 100644
--- a/source/BlockEntities/HopperEntity.cpp
+++ b/source/BlockEntities/HopperEntity.cpp
@@ -16,17 +16,6 @@
-cHopperEntity::cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
- super(E_BLOCK_HOPPER, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, NULL),
- m_LastMoveItemsInTick(0),
- m_LastMoveItemsOutTick(0)
-{
-}
-
-
-
-
-
cHopperEntity::cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
super(E_BLOCK_HOPPER, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
m_LastMoveItemsInTick(0),
diff --git a/source/BlockEntities/HopperEntity.h b/source/BlockEntities/HopperEntity.h
index 1a7650581..3eaa05b7c 100644
--- a/source/BlockEntities/HopperEntity.h
+++ b/source/BlockEntities/HopperEntity.h
@@ -30,9 +30,6 @@ public:
TICKS_PER_TRANSFER = 8, ///< How many ticks at minimum between two item transfers to or from the hopper
} ;
- /// Constructor used while generating a chunk; sets m_World to NULL
- cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
-
// tolua_end
/// Constructor used for normal operation
diff --git a/source/BlockEntities/SignEntity.cpp b/source/BlockEntities/SignEntity.cpp
index 8b335651d..81f6f6d77 100644
--- a/source/BlockEntities/SignEntity.cpp
+++ b/source/BlockEntities/SignEntity.cpp
@@ -12,15 +12,6 @@
-cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ) :
- super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, NULL)
-{
-}
-
-
-
-
-
cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World) :
super(a_BlockType, a_X, a_Y, a_Z, a_World)
{
diff --git a/source/BlockEntities/SignEntity.h b/source/BlockEntities/SignEntity.h
index 50706bdfe..d998ff1e8 100644
--- a/source/BlockEntities/SignEntity.h
+++ b/source/BlockEntities/SignEntity.h
@@ -33,12 +33,9 @@ class cSignEntity :
public:
- /// Creates a new empty sign entity at the specified block coords and block type (wall or standing)
- /// Used mainly by plugins while generating chunks
- cSignEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ);
-
// tolua_end
+ /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
bool LoadFromJson( const Json::Value& a_Value );
--
cgit v1.2.3
From 7fddf4479df7f454d340c23c1a93b982dbbbee4d Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 09:49:40 +0100
Subject: Debuggers: Added the BlockEntity test harness when generating chunks.
---
MCServer/Plugins/Debuggers/Debuggers.lua | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 04a15a002..248433ddd 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -26,6 +26,7 @@ function Initialize(Plugin)
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
PluginManager = cRoot:Get():GetPluginManager();
PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
@@ -531,6 +532,27 @@ end
+function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
+ -- Get the topmost block coord:
+ local Height = a_ChunkDesc:GetHeight(0, 0);
+
+ -- Create a sign there:
+ a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
+ local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
+ if (BlockEntity ~= nil) then
+ LOG("Setting sign lines...");
+ local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
+ SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
+ end
+
+ -- Update the heightmap:
+ a_ChunkDesc:SetHeight(0, 0, Height + 1);
+end
+
+
+
+
+
-- Function "round" copied from http://lua-users.org/wiki/SimpleRound
function round(num, idp)
local mult = 10^(idp or 0)
--
cgit v1.2.3
From 9048a3b66d4d2ad59590037f394eabd9ad7a294c Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 09:56:07 +0100
Subject: Re-added rose to items.ini.
---
MCServer/items.ini | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/MCServer/items.ini b/MCServer/items.ini
index 7eb8f56b4..812168297 100644
--- a/MCServer/items.ini
+++ b/MCServer/items.ini
@@ -118,7 +118,11 @@ dkgreenwool=35:13
redwool=35:14
blackwool=35:15
dandelion=37
-flower=38
+
+; Obsolete, use "dandelion" instead (kept for compatibility, will be removed)
+flower=37
+
+rose=38
brownmushroom=39
redmushroom=40
gold=41
--
cgit v1.2.3
From 6e5d7b70a15214078ec6a5b973ee43217cea6897 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 10:09:54 +0100
Subject: APIDump: Removed the BlockEntity constructors' docs.
---
MCServer/Plugins/APIDump/APIDesc.lua | 86 ++++++++++--------------------------
1 file changed, 24 insertions(+), 62 deletions(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 321f50732..cd3fe366a 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -403,20 +403,12 @@ g_APIDesc =
in the world. Note that doublechests consist of two separate cChestEntity objects, they do not collaborate
in any way.
- The chest entity can be created by the plugins only in the {{OnChunkGenerating}} and
- {{OnChunkGenerated}} hooks, as part of the new chunk being generated. Plugins may generate chests
- with contents in this way.
-
To manipulate a chest already in the game, you need to use {{cWorld}}'s callback mechanism with
either DoWithChestAt() or ForEachChestInChunk() function. See the code example below
]],
Inherits = "cBlockEntityWithItems",
- Functions =
- {
- constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cChestEntity", Notes = "Creates a new cChestEntity object. To be used only in the chunk generating hooks {{OnChunkGenerating}} and {{OnChunkGenerated}}." },
- },
Constants =
{
ContentsHeight = { Notes = "Height of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" },
@@ -642,40 +634,31 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
cDispenserEntity =
{
- Desc = [[This class represents a dispenser block entity in the world. Most of this block entity's functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior common with a {{cDropperEntity|dropper}} entity.
-
- An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks).
-]],
- Functions =
- {
- constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cDispenserEntity", Notes = "Creates a new cDispenserEntity at the specified coords" },
- },
- Constants =
- {
- },
+ Desc = [[
+ This class represents a dispenser block entity in the world. Most of this block entity's
+ functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents
+ the behavior common with a {{cDropperEntity|dropper}} entity.
+ ]],
Inherits = "cDropSpenserEntity",
},
cDropperEntity =
{
- Desc = [[This class represents a dropper block entity in the world. Most of this block entity's functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior common with the {{cDispenserEntity|dispenser}} entity.
-
- An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks).
-]],
- Functions =
- {
- constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cDropperEntity", Notes = "Creates a new cDropperEntity at the specified coords" },
- },
- Constants =
- {
- },
+ Desc = [[
+ This class represents a dropper block entity in the world. Most of this block entity's functionality
+ is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior
+ common with the {{cDispenserEntity|dispenser}} entity.
+
+ An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks).
+ ]],
Inherits = "cDropSpenserEntity",
- },
+ }, -- cDropperEntity
cDropSpenserEntity =
{
- Desc = [[This is a class that implements behavior common to both {{cDispenserEntity|dispensers}} and {{cDropperEntity|droppers}}.
-]],
+ Desc = [[
+ This is a class that implements behavior common to both {{cDispenserEntity|dispensers}} and {{cDropperEntity|droppers}}.
+ ]],
Functions =
{
Activate = { Params = "", Return = "", Notes = "Sets the block entity to dropspense an item in the next tick" },
@@ -687,9 +670,8 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
ContentsWidth = { Notes = "Width (X) of the {{cItemGrid}} representing the contents" },
ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid}} representing the contents" },
},
-
Inherits = "cBlockEntityWithItems";
- },
+ }, -- cDropSpenserEntity
cEnchantments =
{
@@ -913,7 +895,6 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
cFile:Delete("/usr/bin/virus.exe");
]],
-
Functions =
{
Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." },
@@ -925,8 +906,7 @@ cFile:Delete("/usr/bin/virus.exe");
IsFolder = { Params = "Path", Return = "bool", Notes = "Returns true if the specified path points to an existing folder." },
Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." },
},
-
- },
+ }, -- cFile
cFireChargeEntity =
{
@@ -938,11 +918,11 @@ cFile:Delete("/usr/bin/virus.exe");
cFurnaceEntity =
{
- Desc = [[This class represents a furnace block entity in the world. An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks)
-]],
+ Desc = [[
+ This class represents a furnace block entity in the world.
+ ]],
Functions =
{
- constructor = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "cFurnaceEntity", Notes = "Creates a new cFurnaceEntity at the specified coords and the specified block type / meta" },
GetCookTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current item finishes cooking, in ticks" },
GetFuelBurnTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current fuel is depleted, in ticks" },
GetFuelSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the fuel slot" },
@@ -996,14 +976,10 @@ cFile:Delete("/usr/bin/virus.exe");
cHopperEntity =
{
Desc = [[
- This class represents a hopper block entity in the world.
-
- Plugins may use this class during chunk generation ({{OnChunkGenerated|HOOK_CHUNK_GENERATED}} and
- {{OnChunkGenerating|HOOK_CHUNK_GENERATING}}) to add hoppers to the generated chunk.
+ This class represents a hopper block entity in the world.
]],
Functions =
{
- constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cHopperEntity", Notes = "Creates and returns a new hopper at the specified coords." },
GetOutputBlockPos = { Params = "BlockMeta", Return = "bool, BlockX, BlockY, BlockZ", Notes = "Returns whether the hopper is attached, and if so, the block coords of the block receiving the output items, based on the given meta." },
},
Constants =
@@ -1852,7 +1828,7 @@ a_Player:OpenWindow(Window);
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
-]],
+ ]],
Functions =
{
AddHook =
@@ -1872,7 +1848,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
},
DisablePlugin = { Params = "PluginName", Return = "bool", Notes = "Disables a plugin specified by its name. Returns true if the plugin was disabled, false if it wasn't found or wasn't active." },
ExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Executes the command as if given by the specified Player. Checks permissions. Returns true if executed." },
- ExecuteConsoleCommand = { Params = "CommandStr", Return = "bool", Notes = "Executes the command as if given on the server console. Returns true if executed." },
FindPlugins = { Params = "", Return = "", Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)" },
ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Same as ExecuteCommand, but doesn't check permissions" },
ForEachCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindCommand(). The CallbackFn has the following signature: function(Command, Permission, HelpString)
. If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
@@ -2000,7 +1975,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
GetVirtualRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of virtual RAM that the entire MCServer process is using, in KiB. Negative if the OS doesn't support this query." },
GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." },
GetWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Returns the cWorld object of the given world. It returns nil if there is no world with the given name." },
- QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread The command's output will be sent to console " .. '"stop" and "restart" commands have special handling.' },
+ QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread. The command's output will be sent to console." },
SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds." },
SetPrimaryServerVersion = { Params = "Protocol Version", Return = "", Notes = "Sets the servers PrimaryServerVersion to the given protocol number." }
},
@@ -2048,18 +2023,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
Inherits = "cBlockEntity";
},
- cStringMap =
- {
- Desc = [[cStringMap is an object that maps strings with strings, it's also known as a dictionary
-]],
- Functions =
- {
- },
- Constants =
- {
- },
- },
-
cThrownEggEntity =
{
Desc = "",
@@ -2238,7 +2201,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
},
GetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the block skylight of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
GetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ", Return = "BlockValid, BlockType, BlockMeta", Notes = "Returns the block type and metadata for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true." },
- GetClassStatic = { Params = "", Return = "string", Notes = "Returns the name of the class, \"cWorld\"." },
GetDimension = { Params = "", Return = "eDimension", Notes = "Returns the dimension of the world - dimOverworld, dimNether or dimEnd." },
GetGameMode = { Params = "", Return = "eGameMode", Notes = "Returns the gamemode of the world - gmSurvival, gmCreative or gmAdventure." },
GetGeneratorQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks that are queued in the chunk generator." },
--
cgit v1.2.3
From 90fc51c4d03a941035b07d9d303ec542ff257b8b Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 10:13:32 +0100
Subject: cRoot::SaveAllChunks() doesn't wait for the save (deadlocks).
Rather, it only queues the save task onto each world's tick thread.
---
MCServer/Plugins/APIDump/APIDesc.lua | 2 +-
source/Root.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index cd3fe366a..9f95ce5e3 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1976,7 +1976,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." },
GetWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Returns the cWorld object of the given world. It returns nil if there is no world with the given name." },
QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread. The command's output will be sent to console." },
- SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds." },
+ SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds. Note that the saving is queued on each world's tick thread and this functions returns before the chunks are actually saved." },
SetPrimaryServerVersion = { Params = "Protocol Version", Return = "", Notes = "Sets the servers PrimaryServerVersion to the given protocol number." }
},
Constants =
diff --git a/source/Root.cpp b/source/Root.cpp
index 701832be7..be5a0553c 100644
--- a/source/Root.cpp
+++ b/source/Root.cpp
@@ -489,7 +489,7 @@ void cRoot::SaveAllChunks(void)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr)
{
- itr->second->SaveAllChunks();
+ itr->second->QueueSaveAllChunks();
}
}
--
cgit v1.2.3
From 49d6afd501c16a782881e30bce2f908d730ce767 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 10:15:27 +0100
Subject: Removed cBlockEntity:CreateByBlockType() from the Lua API.
Plugins cannot be allowed to create block entities, that would result in memory leaks.
---
source/Bindings.cpp | 43 +-------------------------------------
source/Bindings.h | 2 +-
source/BlockEntities/BlockEntity.h | 4 ++--
3 files changed, 4 insertions(+), 45 deletions(-)
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 583bbfeb7..93c66d233 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:12.
+** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:19.
*/
#ifndef __cplusplus
@@ -17578,46 +17578,6 @@ tolua_lerror:
}
#endif //#ifndef TOLUA_DISABLE
-/* method: CreateByBlockType of class cBlockEntity */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_CreateByBlockType00
-static int tolua_AllToLua_cBlockEntity_CreateByBlockType00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"cBlockEntity",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_isnumber(tolua_S,6,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,7,"cWorld",1,&tolua_err) ||
- !tolua_isnoobj(tolua_S,8,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0));
- unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0));
- int a_BlockX = ((int) tolua_tonumber(tolua_S,4,0));
- int a_BlockY = ((int) tolua_tonumber(tolua_S,5,0));
- int a_BlockZ = ((int) tolua_tonumber(tolua_S,6,0));
- cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,7,NULL));
- {
- cBlockEntity* tolua_ret = (cBlockEntity*) cBlockEntity::CreateByBlockType(a_BlockType,a_BlockMeta,a_BlockX,a_BlockY,a_BlockZ,a_World);
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockEntity");
- }
- }
- return 1;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'CreateByBlockType'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
/* method: GetPosX of class cBlockEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosX00
static int tolua_AllToLua_cBlockEntity_GetPosX00(lua_State* tolua_S)
@@ -30932,7 +30892,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",NULL);
#endif
tolua_beginmodule(tolua_S,"cBlockEntity");
- tolua_function(tolua_S,"CreateByBlockType",tolua_AllToLua_cBlockEntity_CreateByBlockType00);
tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cBlockEntity_GetPosX00);
tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cBlockEntity_GetPosY00);
tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cBlockEntity_GetPosZ00);
diff --git a/source/Bindings.h b/source/Bindings.h
index a853b3521..13f398a4d 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:13.
+** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:20.
*/
/* Exported function */
diff --git a/source/BlockEntities/BlockEntity.h b/source/BlockEntities/BlockEntity.h
index 6a6ffb448..a2de3160a 100644
--- a/source/BlockEntities/BlockEntity.h
+++ b/source/BlockEntities/BlockEntity.h
@@ -47,13 +47,13 @@ public:
m_World = a_World;
}
- // tolua_begin
-
/// Creates a new block entity for the specified block type
/// If a_World is valid, then the entity is created bound to that world
/// Returns NULL for unknown block types
static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = NULL);
+ // tolua_begin
+
// Position, in absolute block coordinates:
int GetPosX(void) const { return m_PosX; }
int GetPosY(void) const { return m_PosY; }
--
cgit v1.2.3
From 5eb67dbdfcaeb52be11a5dde75338bf24e2e5969 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 11:28:11 +0100
Subject: Debuggers: Removed the old OnChunkGenerated code testing the
cBlockArea writing.
---
MCServer/Plugins/Debuggers/Debuggers.lua | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 248433ddd..a13820eff 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -500,21 +500,6 @@ end
-function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc)
- -- Test ChunkDesc / BlockArea interaction
- local BlockArea = cBlockArea();
- ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15);
-
- -- BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic");
-
- ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5);
- return false;
-end
-
-
-
-
-
function OnChat(a_Player, a_Message)
return false, "blabla " .. a_Message;
end
--
cgit v1.2.3
From ee1ac65e541cc8f57cca644288d560b43e20e1e0 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 11:33:24 +0100
Subject: cChunkDesc::GetBlockEntity() re-creates block entity when blocktype
doesn't match.
---
source/Generating/ChunkDesc.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp
index 039f30d9c..9fb306996 100644
--- a/source/Generating/ChunkDesc.cpp
+++ b/source/Generating/ChunkDesc.cpp
@@ -535,7 +535,14 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
{
if (((*itr)->GetPosX() == AbsX) && ((*itr)->GetPosY() == a_RelY) && ((*itr)->GetPosZ() == AbsZ))
{
- // Already in the list, return it:
+ // Already in the list:
+ if ((*itr)->GetBlockType() != GetBlockType(a_RelX, a_RelY, a_RelZ))
+ {
+ // Wrong type, the block type has been overwritten. Erase and create new:
+ m_BlockEntities.erase(itr);
+ break;
+ }
+ // Correct type, already present. Return it:
return *itr;
}
} // for itr - m_BlockEntities[]
--
cgit v1.2.3
From 4f2645d0e56bef4db9e72ce0b9f5d6c28ab98a75 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 11:34:43 +0100
Subject: APIDump: Documented cChunkDesc:GetBlockEntity().
---
MCServer/Plugins/APIDump/APIDesc.lua | 38 +++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 9f95ce5e3..0604032b0 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -458,6 +458,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
{ Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
},
GetBiome = { Params = "RelX, RelZ", Return = "EMCSBiome", Notes = "Returns the biome at the specified relative coords" },
+ GetBlockEntity = { Params = "RelX, RelY, RelZ", Return = "{{cBlockEntity}} descendant", Notes = "Returns the block entity for the block at the specified coords. Creates it if it doesn't exist. Returns nil if the block has no block entity capability." },
GetBlockMeta = { Params = "RelX, RelY, RelZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" },
GetBlockType = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" },
GetBlockTypeMeta = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" },
@@ -496,7 +497,42 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
Constants =
{
},
- },
+ AdditionalInfo =
+ {
+ {
+ Header = "Manipulating block entities",
+ Contents = [[
+ To manipulate block entities while the chunk is generated, first use SetBlockTypeMeta() to set
+ the correct block type and meta at the position. Then use the GetBlockEntity() to create and
+ return the correct block entity instance. Finally, use tolua.cast() to cast to the proper
+ type.
+ Note that you don't need to check if a block entity has previously existed at the place, because
+ GetBlockEntity() will automatically re-create the correct type for you.
+
+ The following code is taken from the Debuggers plugin, it creates a sign at each chunk's [0, 0]
+ coords, with the text being the chunk coords:
+
+function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
+ -- Get the topmost block coord:
+ local Height = a_ChunkDesc:GetHeight(0, 0);
+
+ -- Create a sign there:
+ a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
+ local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
+ if (BlockEntity ~= nil) then
+ LOG("Setting sign lines...");
+ local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
+ SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
+ end
+
+ -- Update the heightmap:
+ a_ChunkDesc:SetHeight(0, 0, Height + 1);
+end
+
+ ]],
+ },
+ }, -- AdditionalInfo
+ }, -- cChunkDesc
cClientHandle =
{
--
cgit v1.2.3
From 194aa1decb532859439f4f554069883e96a0ce48 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 12:42:35 +0100
Subject: APIDump: Documented the cJukeboxEntity.
---
MCServer/Plugins/APIDump/APIDesc.lua | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 0604032b0..993c2a40b 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1464,6 +1464,22 @@ end
},
}, -- cItems
+ cJukeboxEntity =
+ {
+ Desc = [[
+ This class represents a jukebox in the world. It can play the records, either when the
+ {{cPlayer|player}} uses the record on the jukebox, or when a plugin instructs it to play.
+ ]],
+ Inherits = "cBlockEntity",
+ Functions =
+ {
+ EjectRecord = { Params = "", Return = "", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0)" },
+ GetRecord = { Params = "", Return = "number", Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records." },
+ PlayRecord = { Params = "", Return = "", Notes = "Plays the currently present record. No action if there's no current record." },
+ SetRecord = { Params = "number", Return = "", Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records." },
+ },
+ }, -- cJukeboxEntity
+
cLineBlockTracer =
{
Desc = [[Objects of this class provide an easy-to-use interface to tracing lines through individual
--
cgit v1.2.3
From 7586e832bf74d6ca9f6fcfe75f55378b6ea3ac20 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 13:10:36 +0100
Subject: APIDump: Documented cNoteEntity.
---
MCServer/Plugins/APIDump/APIDesc.lua | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 993c2a40b..54bd86c77 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1711,7 +1711,26 @@ a_Player:OpenWindow(Window);
mtZombiePigman = { Notes = "" },
},
Inherits = "cPawn",
- },
+ }, -- cMonster
+
+ cNoteEntity =
+ {
+ Desc = [[
+ This class represents a note block entity in the world. It takes care of the note block's pitch,
+ and also can play the sound, either when the {{cPlayer|player}} right-clicks it, redstone activates
+ it, or upon a plugin's request.
+
+ The pitch is stored as an integer between 0 and 24.
+ ]],
+ Functions =
+ {
+ GetPitch = { Params = "", Return = "number", Notes = "Returns the current pitch set for the block" },
+ IncrementPitch = { Params = "", Return = "", Notes = "Adds 1 to the current pitch. Wraps around to 0 when the pitch cannot go any higher." },
+ MakeSound = { Params = "", Return = "", Notes = "Plays the sound for all {{cClientHandle|clients}} near this block." },
+ SetPitch = { Params = "Pitch", Return = "", Notes = "Sets a new pitch for the block." },
+ },
+ Inherits = "cBlockEntity",
+ }, -- cNoteEntity
cPawn =
{
--
cgit v1.2.3
From 26d3dd3466266c971edd43986e5aad9580ebbca9 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 13:34:20 +0100
Subject: APIDump: Documented cSignEntity.
---
MCServer/Plugins/APIDump/APIDesc.lua | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 54bd86c77..fe5d7bed1 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2076,23 +2076,22 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
Constants =
{
},
- },
+ }, -- cServer
cSignEntity =
{
Desc = [[
A sign entity represents a sign in the world. This class is only used when generating chunks, so
- that the plugins may generate signs within new chunks.
+ that the plugins may generate signs within new chunks. See the code example in {{cChunkDesc}}.
]],
Functions =
{
+ GetLine = { Params = "LineIndex", Return = "string", Notes = "Returns the specified line. LineIndex is expected between 0 and 3. Returns empty string and logs to server console when LineIndex is invalid." },
+ SetLine = { Params = "LineIndex, LineText", Return = "", Notes = "Sets the specified line. LineIndex is expected between 0 and 3. Logs to server console when LineIndex is invalid." },
+ SetLines = { Params = "Line1, Line2, Line3, Line4", Return = "", Notes = "Sets all the sign's lines at once." },
},
- Constants =
- {
- },
-
Inherits = "cBlockEntity";
- },
+ }, -- cSignEntity
cThrownEggEntity =
{
--
cgit v1.2.3
From 2ed8e384192154daf8af94cda390980de88bb6aa Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 15 Nov 2013 13:44:07 +0100
Subject: APIDump: Small fixes and additions.
---
MCServer/Plugins/APIDump/APIDesc.lua | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index fe5d7bed1..741b912a6 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -504,7 +504,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
Contents = [[
To manipulate block entities while the chunk is generated, first use SetBlockTypeMeta() to set
the correct block type and meta at the position. Then use the GetBlockEntity() to create and
- return the correct block entity instance. Finally, use tolua.cast() to cast to the proper
+ return the correct block entity instance. Finally, use {{tolua}}.cast() to cast to the proper
type.
Note that you don't need to check if a block entity has previously existed at the place, because
GetBlockEntity() will automatically re-create the correct type for you.
@@ -756,6 +756,8 @@ end
enchInfinity = { Notes = "" },
enchKnockback = { Notes = "" },
enchLooting = { Notes = "" },
+ enchLuckOfTheSea = { Notes = "" },
+ enchLure = { Notes = "" },
enchPower = { Notes = "" },
enchProjectileProtection = { Notes = "" },
enchProtection = { Notes = "" },
@@ -1267,6 +1269,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
DamageItem = { Params = "[Amount]", Return = "bool", Notes = "Adds the specified damage. Returns true when damage reaches max value and the item should be destroyed (but doesn't destroy the item)" },
Empty = { Params = "", Return = "", Notes = "Resets the instance to an empty item" },
GetMaxDamage = { Params = "", Return = "number", Notes = "Returns the maximum value for damage that this item can get before breaking; zero if damage is not accounted for for this item type" },
+ GetMaxStackSize = { Params = "", Return = "number", Notes = "Returns the maximum stack size for this item." },
IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" },
IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" },
IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage and enchantments)" },
--
cgit v1.2.3