Implemented droppers
Added a common ancestor class "DropSpenser" that has the common code for dropper and dispenser and is Lua-accessible, too. The Debuggers plugin now triggers both droppers and dispensers when rclking them with a redstone torch. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1514 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
b4522bf14e
commit
5c3235ecdc
@ -3,8 +3,7 @@
|
||||
PLUGIN = {}; -- Reference to own plugin object
|
||||
ShouldDumpFunctions = true; -- If set to true, all available functions are logged upon plugin initialization
|
||||
|
||||
g_DispensersToActivate = {}; -- A list of dispensers (as {World, X, Y Z} quadruplets) that are to be activated every tick
|
||||
g_DroppersToActivate = {}; -- A list of droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
|
||||
g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
|
||||
|
||||
|
||||
|
||||
@ -366,11 +365,11 @@ function OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX
|
||||
-- Redstone torch activates a rapid dispenser / dropper discharge (at every tick):
|
||||
local BlockType = Player:GetWorld():GetBlock(BlockX, BlockY, BlockZ);
|
||||
if (BlockType == E_BLOCK_DISPENSER) then
|
||||
table.insert(g_DispensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
|
||||
table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
|
||||
Player:SendMessage("Dispenser at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
|
||||
return true;
|
||||
elseif (BlockType == E_BLOCK_DROPPER) then
|
||||
table.insert(g_DroppersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
|
||||
table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
|
||||
Player:SendMessage("Dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
|
||||
return true;
|
||||
else
|
||||
@ -445,20 +444,20 @@ end
|
||||
|
||||
|
||||
function OnTick()
|
||||
-- Activate all dispensers in the g_DispensersToActivate list:
|
||||
local ActivateDisp = function(Dispenser)
|
||||
if (Dispenser:GetContents():GetFirstUsedSlot() == -1) then
|
||||
-- Activate all dropspensers in the g_DropSpensersToActivate list:
|
||||
local ActivateDrSp = function(DropSpenser)
|
||||
if (DropSpenser:GetContents():GetFirstUsedSlot() == -1) then
|
||||
return true;
|
||||
end
|
||||
Dispenser:Activate();
|
||||
DropSpenser:Activate();
|
||||
return false;
|
||||
end
|
||||
|
||||
local idx = #g_DispensersToActivate;
|
||||
-- Walk the list backwards, because we're removing some items
|
||||
local idx = #g_DropSpensersToActivate;
|
||||
for i = idx, 1, -1 do
|
||||
local Disp = g_DispensersToActivate[i];
|
||||
if not(Disp.World:DoWithDispenserAt(Disp.x, Disp.y, Disp.z, ActivateDisp)) then
|
||||
table.remove(g_DispensersToActivate, i);
|
||||
local DrSp = g_DropSpensersToActivate[i];
|
||||
if not(DrSp.World:DoWithDropSpenserAt(DrSp.x, DrSp.y, DrSp.z, ActivateDrSp)) then
|
||||
table.remove(g_DropSpensersToActivate, i);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -269,7 +269,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
RelativePath=".\resource_MCServer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -1812,10 +1812,6 @@
|
||||
RelativePath="..\source\blocks\BlockDirt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockDispenser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockDoor.cpp"
|
||||
>
|
||||
@ -1824,6 +1820,10 @@
|
||||
RelativePath="..\source\blocks\BlockDoor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockDropSpenser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Blocks\BlockEnderchest.h"
|
||||
>
|
||||
@ -2320,6 +2320,22 @@
|
||||
RelativePath="..\source\DispenserEntity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\DropperEntity.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\DropperEntity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\DropSpenserEntity.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\DropSpenserEntity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\FurnaceEntity.cpp"
|
||||
>
|
||||
|
@ -42,7 +42,9 @@ $cfile "ItemGrid.h"
|
||||
$cfile "BlockEntity.h"
|
||||
$cfile "BlockEntityWithItems.h"
|
||||
$cfile "ChestEntity.h"
|
||||
$cfile "DropSpenserEntity.h"
|
||||
$cfile "DispenserEntity.h"
|
||||
$cfile "DropperEntity.h"
|
||||
$cfile "WebAdmin.h"
|
||||
$cfile "WebPlugin.h"
|
||||
$cfile "Pickup.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 05/24/13 23:12:14.
|
||||
** Generated automatically by tolua++-1.0.92 on 05/26/13 16:21:49.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
@ -41,7 +41,9 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
|
||||
#include "BlockEntity.h"
|
||||
#include "BlockEntityWithItems.h"
|
||||
#include "ChestEntity.h"
|
||||
#include "DropSpenserEntity.h"
|
||||
#include "DispenserEntity.h"
|
||||
#include "DropperEntity.h"
|
||||
#include "WebAdmin.h"
|
||||
#include "WebPlugin.h"
|
||||
#include "Pickup.h"
|
||||
@ -60,6 +62,13 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
|
||||
/* function to release collected object via destructor */
|
||||
#ifdef __cplusplus
|
||||
|
||||
static int tolua_collect_cCraftingGrid (lua_State* tolua_S)
|
||||
{
|
||||
cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0);
|
||||
Mtolua_delete(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_collect_cItem (lua_State* tolua_S)
|
||||
{
|
||||
cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0);
|
||||
@ -74,9 +83,9 @@ static int tolua_collect_Vector3f (lua_State* tolua_S)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_collect_cIniFile (lua_State* tolua_S)
|
||||
static int tolua_collect_cDropperEntity (lua_State* tolua_S)
|
||||
{
|
||||
cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0);
|
||||
cDropperEntity* self = (cDropperEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
Mtolua_delete(self);
|
||||
return 0;
|
||||
}
|
||||
@ -95,9 +104,9 @@ static int tolua_collect_cItems (lua_State* tolua_S)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_collect_cCraftingGrid (lua_State* tolua_S)
|
||||
static int tolua_collect_cBlockArea (lua_State* tolua_S)
|
||||
{
|
||||
cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0);
|
||||
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
|
||||
Mtolua_delete(self);
|
||||
return 0;
|
||||
}
|
||||
@ -137,16 +146,16 @@ static int tolua_collect_Vector3i (lua_State* tolua_S)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_collect_cBlockArea (lua_State* tolua_S)
|
||||
static int tolua_collect_cTracer (lua_State* tolua_S)
|
||||
{
|
||||
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
|
||||
cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0);
|
||||
Mtolua_delete(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_collect_cTracer (lua_State* tolua_S)
|
||||
static int tolua_collect_cIniFile (lua_State* tolua_S)
|
||||
{
|
||||
cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0);
|
||||
cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0);
|
||||
Mtolua_delete(self);
|
||||
return 0;
|
||||
}
|
||||
@ -169,36 +178,38 @@ static void tolua_reg_types (lua_State* tolua_S)
|
||||
tolua_usertype(tolua_S,"cStringMap");
|
||||
tolua_usertype(tolua_S,"cItemGrid");
|
||||
tolua_usertype(tolua_S,"cBlockArea");
|
||||
tolua_usertype(tolua_S,"cCraftingGrid");
|
||||
tolua_usertype(tolua_S,"cInventory");
|
||||
tolua_usertype(tolua_S,"cRoot");
|
||||
tolua_usertype(tolua_S,"cCraftingGrid");
|
||||
tolua_usertype(tolua_S,"cCuboid");
|
||||
tolua_usertype(tolua_S,"cStairs");
|
||||
tolua_usertype(tolua_S,"cGroup");
|
||||
tolua_usertype(tolua_S,"cTracer");
|
||||
tolua_usertype(tolua_S,"cCuboid");
|
||||
tolua_usertype(tolua_S,"cPickup");
|
||||
tolua_usertype(tolua_S,"cItems");
|
||||
tolua_usertype(tolua_S,"cTracer");
|
||||
tolua_usertype(tolua_S,"Vector3i");
|
||||
tolua_usertype(tolua_S,"cClientHandle");
|
||||
tolua_usertype(tolua_S,"cChunkDesc");
|
||||
tolua_usertype(tolua_S,"cFurnaceRecipe");
|
||||
tolua_usertype(tolua_S,"Vector3i");
|
||||
tolua_usertype(tolua_S,"cChatColor");
|
||||
tolua_usertype(tolua_S,"cStairs");
|
||||
tolua_usertype(tolua_S,"Lua__cPickup");
|
||||
tolua_usertype(tolua_S,"cChatColor");
|
||||
tolua_usertype(tolua_S,"cWebAdmin");
|
||||
tolua_usertype(tolua_S,"cCraftingRecipes");
|
||||
tolua_usertype(tolua_S,"Lua__cWebPlugin");
|
||||
tolua_usertype(tolua_S,"Lua__cPawn");
|
||||
tolua_usertype(tolua_S,"cWebAdmin");
|
||||
tolua_usertype(tolua_S,"cGroupManager");
|
||||
tolua_usertype(tolua_S,"cItem");
|
||||
tolua_usertype(tolua_S,"Vector3f");
|
||||
tolua_usertype(tolua_S,"cGroupManager");
|
||||
tolua_usertype(tolua_S,"cCraftingRecipes");
|
||||
tolua_usertype(tolua_S,"Lua__cPlayer");
|
||||
tolua_usertype(tolua_S,"cWebPlugin");
|
||||
tolua_usertype(tolua_S,"cDropSpenserEntity");
|
||||
tolua_usertype(tolua_S,"Lua__cPlayer");
|
||||
tolua_usertype(tolua_S,"HTTPRequest");
|
||||
tolua_usertype(tolua_S,"cChestEntity");
|
||||
tolua_usertype(tolua_S,"cDispenserEntity");
|
||||
tolua_usertype(tolua_S,"HTTPRequest");
|
||||
tolua_usertype(tolua_S,"HTTPFormData");
|
||||
tolua_usertype(tolua_S,"cBlockEntity");
|
||||
tolua_usertype(tolua_S,"cItemGrid::cListener");
|
||||
tolua_usertype(tolua_S,"HTTPFormData");
|
||||
tolua_usertype(tolua_S,"cDropperEntity");
|
||||
tolua_usertype(tolua_S,"cPlugin");
|
||||
tolua_usertype(tolua_S,"cPluginManager");
|
||||
tolua_usertype(tolua_S,"cBlockEntityWithItems");
|
||||
@ -15159,6 +15170,91 @@ tolua_lerror:
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: RemoveOneItem of class cItemGrid */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem00
|
||||
static int tolua_AllToLua_cItemGrid_RemoveOneItem00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL);
|
||||
#endif
|
||||
{
|
||||
cItem tolua_ret = (cItem) self->RemoveOneItem(a_SlotNum);
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
void* tolua_obj = Mtolua_new((cItem)(tolua_ret));
|
||||
tolua_pushusertype(tolua_S,tolua_obj,"cItem");
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
#else
|
||||
void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem));
|
||||
tolua_pushusertype(tolua_S,tolua_obj,"cItem");
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'RemoveOneItem'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: RemoveOneItem of class cItemGrid */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem01
|
||||
static int tolua_AllToLua_cItemGrid_RemoveOneItem01(lua_State* tolua_S)
|
||||
{
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
{
|
||||
cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL);
|
||||
#endif
|
||||
{
|
||||
cItem tolua_ret = (cItem) self->RemoveOneItem(a_X,a_Y);
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
void* tolua_obj = Mtolua_new((cItem)(tolua_ret));
|
||||
tolua_pushusertype(tolua_S,tolua_obj,"cItem");
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
#else
|
||||
void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem));
|
||||
tolua_pushusertype(tolua_S,tolua_obj,"cItem");
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
tolua_lerror:
|
||||
return tolua_AllToLua_cItemGrid_RemoveOneItem00(tolua_S);
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: HowManyItems of class cItemGrid */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HowManyItems00
|
||||
static int tolua_AllToLua_cItemGrid_HowManyItems00(lua_State* tolua_S)
|
||||
@ -15935,6 +16031,96 @@ static int tolua_get_cChestEntity___cBlockEntityWindowOwner__(lua_State* tolua_S
|
||||
}
|
||||
#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)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cDropSpenserEntity",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
|
||||
{
|
||||
cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
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_Direction = (( unsigned char) tolua_tonumber(tolua_S,5,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddDropSpenserDir'", NULL);
|
||||
#endif
|
||||
{
|
||||
self->AddDropSpenserDir(a_BlockX,a_BlockY,a_BlockZ,a_Direction);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)a_BlockX);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)a_BlockY);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)a_BlockZ);
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'AddDropSpenserDir'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: Activate of class cDropSpenserEntity */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_Activate00
|
||||
static int tolua_AllToLua_cDropSpenserEntity_Activate00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Activate'", NULL);
|
||||
#endif
|
||||
{
|
||||
self->Activate();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'Activate'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* get function: __cBlockEntityWindowOwner__ of class cDropSpenserEntity */
|
||||
#ifndef TOLUA_DISABLE_tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__
|
||||
static int tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__(lua_State* tolua_S)
|
||||
{
|
||||
cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
tolua_pushusertype(tolua_S,(void*)static_cast<cBlockEntityWindowOwner*>(self), "cBlockEntityWindowOwner");
|
||||
#else
|
||||
tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#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)
|
||||
@ -16004,51 +16190,72 @@ static int tolua_AllToLua_cDispenserEntity_new00_local(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: Activate of class cDispenserEntity */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cDispenserEntity_Activate00
|
||||
static int tolua_AllToLua_cDispenserEntity_Activate00(lua_State* tolua_S)
|
||||
/* 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_isusertype(tolua_S,1,"cDispenserEntity",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
!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
|
||||
{
|
||||
cDispenserEntity* self = (cDispenserEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Activate'", NULL);
|
||||
#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));
|
||||
{
|
||||
self->Activate();
|
||||
cDropperEntity* tolua_ret = (cDropperEntity*) Mtolua_new((cDropperEntity)(a_BlockX,a_BlockY,a_BlockZ));
|
||||
tolua_pushusertype(tolua_S,(void*)tolua_ret,"cDropperEntity");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'Activate'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* get function: __cBlockEntityWindowOwner__ of class cDispenserEntity */
|
||||
#ifndef TOLUA_DISABLE_tolua_get_cDispenserEntity___cBlockEntityWindowOwner__
|
||||
static int tolua_get_cDispenserEntity___cBlockEntityWindowOwner__(lua_State* tolua_S)
|
||||
/* 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)
|
||||
{
|
||||
cDispenserEntity* self = (cDispenserEntity*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
tolua_pushusertype(tolua_S,(void*)static_cast<cBlockEntityWindowOwner*>(self), "cBlockEntityWindowOwner");
|
||||
#else
|
||||
tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner");
|
||||
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
|
||||
|
||||
@ -25395,6 +25602,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_constant(tolua_S,"E_BLOCK_HOPPER",E_BLOCK_HOPPER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_QUARTZ_BLOCK",E_BLOCK_QUARTZ_BLOCK);
|
||||
tolua_constant(tolua_S,"E_BLOCK_ACTIVATOR_RAIL",E_BLOCK_ACTIVATOR_RAIL);
|
||||
tolua_constant(tolua_S,"E_BLOCK_DROPPER",E_BLOCK_DROPPER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_NUMBER_OF_TYPES",E_BLOCK_NUMBER_OF_TYPES);
|
||||
tolua_constant(tolua_S,"E_BLOCK_MAX_TYPE_ID",E_BLOCK_MAX_TYPE_ID);
|
||||
tolua_constant(tolua_S,"E_ITEM_EMPTY",E_ITEM_EMPTY);
|
||||
@ -25567,28 +25775,79 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_constant(tolua_S,"E_ITEM_WAIT_DISC",E_ITEM_WAIT_DISC);
|
||||
tolua_constant(tolua_S,"E_ITEM_LAST_DISC_PLUS_ONE",E_ITEM_LAST_DISC_PLUS_ONE);
|
||||
tolua_constant(tolua_S,"E_ITEM_LAST_DISC",E_ITEM_LAST_DISC);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_APPLE",E_META_PLANKS_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_CONIFER",E_META_PLANKS_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_BIRCH",E_META_PLANKS_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_JUNGLE",E_META_PLANKS_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_LOG_APPLE",E_META_LOG_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_LOG_CONIFER",E_META_LOG_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_LOG_BIRCH",E_META_LOG_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_LOG_JUNGLE",E_META_LOG_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_ZM",E_META_CHEST_FACING_ZM);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_ZP",E_META_CHEST_FACING_ZP);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_XM",E_META_CHEST_FACING_XM);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_XP",E_META_CHEST_FACING_XP);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_YM",E_META_DISPENSER_FACING_YM);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_YP",E_META_DISPENSER_FACING_YP);
|
||||
tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_ZM",E_META_DISPENSER_FACING_ZM);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_ZP",E_META_DISPENSER_FACING_ZP);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_XM",E_META_DISPENSER_FACING_XM);
|
||||
tolua_constant(tolua_S,"E_META_DISPENSER_FACING_XP",E_META_DISPENSER_FACING_XP);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE",E_META_DOUBLE_STEP_STONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_SANDSTONE",E_META_DOUBLE_STEP_SANDSTONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_WOODEN",E_META_DOUBLE_STEP_WOODEN);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_COBBLESTONE",E_META_DOUBLE_STEP_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_BRICK",E_META_DOUBLE_STEP_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_NETHER_BRICK",E_META_DOUBLE_STEP_NETHER_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET);
|
||||
tolua_constant(tolua_S,"E_META_LEAVES_APPLE",E_META_LEAVES_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_LEAVES_CONIFER",E_META_LEAVES_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_LEAVES_BIRCH",E_META_LEAVES_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_LEAVES_JUNGLE",E_META_LEAVES_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_LOG_APPLE",E_META_LOG_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_LOG_CONIFER",E_META_LOG_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_LOG_BIRCH",E_META_LOG_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_LOG_JUNGLE",E_META_LOG_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_APPLE",E_META_PLANKS_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_CONIFER",E_META_PLANKS_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_BIRCH",E_META_PLANKS_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_PLANKS_JUNGLE",E_META_PLANKS_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_NORMAL",E_META_SANDSTONE_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_ORNAMENT",E_META_SANDSTONE_ORNAMENT);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_SMOOTH",E_META_SANDSTONE_SMOOTH);
|
||||
tolua_constant(tolua_S,"E_META_SAPLING_APPLE",E_META_SAPLING_APPLE);
|
||||
tolua_constant(tolua_S,"E_META_SAPLING_CONIFER",E_META_SAPLING_CONIFER);
|
||||
tolua_constant(tolua_S,"E_META_SAPLING_BIRCH",E_META_SAPLING_BIRCH);
|
||||
tolua_constant(tolua_S,"E_META_SAPLING_JUNGLE",E_META_SAPLING_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE",E_META_STEP_STONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_SANDSTONE",E_META_STEP_SANDSTONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_PLANKS",E_META_STEP_PLANKS);
|
||||
tolua_constant(tolua_S,"E_META_STEP_COBBLESTONE",E_META_STEP_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_BRICK",E_META_STEP_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE_BRICK",E_META_STEP_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_NETHER_BRICK",E_META_STEP_NETHER_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE_SECRET",E_META_STEP_STONE_SECRET);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_ORNAMENT",E_META_STONE_BRICK_ORNAMENT);
|
||||
tolua_constant(tolua_S,"E_META_TALL_GRASS_DEAD_SHRUB",E_META_TALL_GRASS_DEAD_SHRUB);
|
||||
tolua_constant(tolua_S,"E_META_TALL_GRASS_GRASS",E_META_TALL_GRASS_GRASS);
|
||||
tolua_constant(tolua_S,"E_META_TALL_GRASS_FERN",E_META_TALL_GRASS_FERN);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_NORMAL",E_META_SANDSTONE_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_ORNAMENT",E_META_SANDSTONE_ORNAMENT);
|
||||
tolua_constant(tolua_S,"E_META_SANDSTONE_SMOOTH",E_META_SANDSTONE_SMOOTH);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_EAST",E_META_TORCH_EAST);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_WEST",E_META_TORCH_WEST);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_SOUTH",E_META_TORCH_SOUTH);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_NORTH",E_META_TORCH_NORTH);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_FLOOR",E_META_TORCH_FLOOR);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_XM",E_META_TORCH_XM);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_APPLE",E_BLOCK_WOODEN_DOUBLE_STEP_APPLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_CONIFER",E_BLOCK_WOODEN_DOUBLE_STEP_CONIFER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_BIRCH",E_BLOCK_WOODEN_DOUBLE_STEP_BIRCH);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_JUNGLE",E_BLOCK_WOODEN_DOUBLE_STEP_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_APPLE",E_BLOCK_WOODEN_STEP_APPLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_CONIFER",E_BLOCK_WOODEN_STEP_CONIFER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_BIRCH",E_BLOCK_WOODEN_STEP_BIRCH);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_JUNGLE",E_BLOCK_WOODEN_STEP_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_WOOL_WHITE",E_META_WOOL_WHITE);
|
||||
tolua_constant(tolua_S,"E_META_WOOL_ORANGE",E_META_WOOL_ORANGE);
|
||||
tolua_constant(tolua_S,"E_META_WOOL_MAGENTA",E_META_WOOL_MAGENTA);
|
||||
@ -25605,56 +25864,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_constant(tolua_S,"E_META_WOOL_GREEN",E_META_WOOL_GREEN);
|
||||
tolua_constant(tolua_S,"E_META_WOOL_RED",E_META_WOOL_RED);
|
||||
tolua_constant(tolua_S,"E_META_WOOL_BLACK",E_META_WOOL_BLACK);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_EAST",E_META_TORCH_EAST);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_WEST",E_META_TORCH_WEST);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_SOUTH",E_META_TORCH_SOUTH);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_NORTH",E_META_TORCH_NORTH);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_FLOOR",E_META_TORCH_FLOOR);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_XM",E_META_TORCH_XM);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM);
|
||||
tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_ZM",E_META_CHEST_FACING_ZM);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_ZP",E_META_CHEST_FACING_ZP);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_XM",E_META_CHEST_FACING_XM);
|
||||
tolua_constant(tolua_S,"E_META_CHEST_FACING_XP",E_META_CHEST_FACING_XP);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE",E_META_DOUBLE_STEP_STONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_SANDSTONE",E_META_DOUBLE_STEP_SANDSTONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_WOODEN",E_META_DOUBLE_STEP_WOODEN);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_COBBLESTONE",E_META_DOUBLE_STEP_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_BRICK",E_META_DOUBLE_STEP_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_NETHER_BRICK",E_META_DOUBLE_STEP_NETHER_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE",E_META_STEP_STONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_SANDSTONE",E_META_STEP_SANDSTONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_PLANKS",E_META_STEP_PLANKS);
|
||||
tolua_constant(tolua_S,"E_META_STEP_COBBLESTONE",E_META_STEP_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_STEP_BRICK",E_META_STEP_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE_BRICK",E_META_STEP_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_NETHER_BRICK",E_META_STEP_NETHER_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STEP_STONE_SECRET",E_META_STEP_STONE_SECRET);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE);
|
||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED);
|
||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_ORNAMENT",E_META_STONE_BRICK_ORNAMENT);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_APPLE",E_BLOCK_WOODEN_DOUBLE_STEP_APPLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_CONIFER",E_BLOCK_WOODEN_DOUBLE_STEP_CONIFER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_BIRCH",E_BLOCK_WOODEN_DOUBLE_STEP_BIRCH);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOUBLE_STEP_JUNGLE",E_BLOCK_WOODEN_DOUBLE_STEP_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_APPLE",E_BLOCK_WOODEN_STEP_APPLE);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_CONIFER",E_BLOCK_WOODEN_STEP_CONIFER);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_BIRCH",E_BLOCK_WOODEN_STEP_BIRCH);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_STEP_JUNGLE",E_BLOCK_WOODEN_STEP_JUNGLE);
|
||||
tolua_constant(tolua_S,"E_META_COAL_NORMAL",E_META_COAL_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL);
|
||||
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_NORMAL",E_META_GOLDEN_APPLE_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_ENCHANTED",E_META_GOLDEN_APPLE_ENCHANTED);
|
||||
tolua_constant(tolua_S,"E_META_TRACKS_X",E_META_TRACKS_X);
|
||||
tolua_constant(tolua_S,"E_META_TRACKS_Z",E_META_TRACKS_Z);
|
||||
tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK);
|
||||
tolua_constant(tolua_S,"E_META_DYE_RED",E_META_DYE_RED);
|
||||
tolua_constant(tolua_S,"E_META_DYE_GREEN",E_META_DYE_GREEN);
|
||||
@ -25671,6 +25882,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_constant(tolua_S,"E_META_DYE_MAGENTA",E_META_DYE_MAGENTA);
|
||||
tolua_constant(tolua_S,"E_META_DYE_ORANGE",E_META_DYE_ORANGE);
|
||||
tolua_constant(tolua_S,"E_META_DYE_WHITE",E_META_DYE_WHITE);
|
||||
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_NORMAL",E_META_GOLDEN_APPLE_NORMAL);
|
||||
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_ENCHANTED",E_META_GOLDEN_APPLE_ENCHANTED);
|
||||
tolua_constant(tolua_S,"E_META_TRACKS_X",E_META_TRACKS_X);
|
||||
tolua_constant(tolua_S,"E_META_TRACKS_Z",E_META_TRACKS_Z);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_CREEPER",E_META_SPAWN_EGG_CREEPER);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_SKELETON",E_META_SPAWN_EGG_SKELETON);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_SPIDER",E_META_SPAWN_EGG_SPIDER);
|
||||
@ -26320,6 +26535,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_function(tolua_S,"AddItems",tolua_AllToLua_cItemGrid_AddItems00);
|
||||
tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount00);
|
||||
tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount01);
|
||||
tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem00);
|
||||
tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem01);
|
||||
tolua_function(tolua_S,"HowManyItems",tolua_AllToLua_cItemGrid_HowManyItems00);
|
||||
tolua_function(tolua_S,"HasItems",tolua_AllToLua_cItemGrid_HasItems00);
|
||||
tolua_function(tolua_S,"GetFirstEmptySlot",tolua_AllToLua_cItemGrid_GetFirstEmptySlot00);
|
||||
@ -26365,19 +26582,33 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_function(tolua_S,".call",tolua_AllToLua_cChestEntity_new00_local);
|
||||
tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cChestEntity___cBlockEntityWindowOwner__,NULL);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_cclass(tolua_S,"cDropSpenserEntity","cDropSpenserEntity","cBlockEntityWithItems",NULL);
|
||||
tolua_beginmodule(tolua_S,"cDropSpenserEntity");
|
||||
tolua_constant(tolua_S,"ContentsHeight",cDropSpenserEntity::ContentsHeight);
|
||||
tolua_constant(tolua_S,"ContentsWidth",cDropSpenserEntity::ContentsWidth);
|
||||
tolua_function(tolua_S,"AddDropSpenserDir",tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00);
|
||||
tolua_function(tolua_S,"Activate",tolua_AllToLua_cDropSpenserEntity_Activate00);
|
||||
tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__,NULL);
|
||||
tolua_endmodule(tolua_S);
|
||||
#ifdef __cplusplus
|
||||
tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cBlockEntityWithItems",tolua_collect_cDispenserEntity);
|
||||
tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",tolua_collect_cDispenserEntity);
|
||||
#else
|
||||
tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cBlockEntityWithItems",NULL);
|
||||
tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",NULL);
|
||||
#endif
|
||||
tolua_beginmodule(tolua_S,"cDispenserEntity");
|
||||
tolua_constant(tolua_S,"ContentsHeight",cDispenserEntity::ContentsHeight);
|
||||
tolua_constant(tolua_S,"ContentsWidth",cDispenserEntity::ContentsWidth);
|
||||
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_function(tolua_S,"Activate",tolua_AllToLua_cDispenserEntity_Activate00);
|
||||
tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cDispenserEntity___cBlockEntityWindowOwner__,NULL);
|
||||
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);
|
||||
tolua_cclass(tolua_S,"HTTPFormData","HTTPFormData","",NULL);
|
||||
tolua_beginmodule(tolua_S,"HTTPFormData");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 05/24/13 23:12:15.
|
||||
** Generated automatically by tolua++-1.0.92 on 05/26/13 16:21:49.
|
||||
*/
|
||||
|
||||
/* Exported function */
|
||||
|
@ -1,20 +1,19 @@
|
||||
|
||||
// BlockDropSpenser.h
|
||||
|
||||
// Declares the cBlockDropSpenserHandler class representing the BlockHandler for Dropper and Dispenser blocks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BlockEntity.h"
|
||||
#include "../World.h"
|
||||
#include "../Piston.h"
|
||||
#include "../Player.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cBlockDispenserHandler :
|
||||
class cBlockDropSpenserHandler :
|
||||
public cBlockEntityHandler
|
||||
{
|
||||
public:
|
||||
cBlockDispenserHandler(BLOCKTYPE a_BlockType) :
|
||||
cBlockDropSpenserHandler(BLOCKTYPE a_BlockType) :
|
||||
cBlockEntityHandler(a_BlockType)
|
||||
{
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
#include "BlockFluid.h"
|
||||
#include "BlockChest.h"
|
||||
#include "BlockFurnace.h"
|
||||
#include "BlockDispenser.h"
|
||||
#include "BlockDropSpenser.h"
|
||||
#include "BlockStairs.h"
|
||||
#include "BlockLadder.h"
|
||||
#include "BlockLever.h"
|
||||
@ -110,9 +110,10 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
case E_BLOCK_CROPS: return new cBlockCropsHandler (a_BlockType);
|
||||
case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType);
|
||||
case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType);
|
||||
case E_BLOCK_DISPENSER: return new cBlockDispenserHandler (a_BlockType);
|
||||
case E_BLOCK_DISPENSER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_STONE_SLAB: return new cBlockSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_WOODEN_SLAB: return new cBlockSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||
case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType);
|
||||
case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType);
|
||||
case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler;
|
||||
|
123
source/Chunk.cpp
123
source/Chunk.cpp
@ -14,6 +14,7 @@
|
||||
#include "Defines.h"
|
||||
#include "ChestEntity.h"
|
||||
#include "DispenserEntity.h"
|
||||
#include "DropperEntity.h"
|
||||
#include "FurnaceEntity.h"
|
||||
#include "SignEntity.h"
|
||||
#include "NoteEntity.h"
|
||||
@ -1135,6 +1136,15 @@ void cChunk::CreateBlockEntities(void)
|
||||
break;
|
||||
}
|
||||
|
||||
case E_BLOCK_DROPPER:
|
||||
{
|
||||
if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
|
||||
{
|
||||
m_BlockEntities.push_back(new cDropperEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case E_BLOCK_FURNACE:
|
||||
{
|
||||
if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
|
||||
@ -1332,6 +1342,11 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType
|
||||
AddBlockEntity( new cDispenserEntity( WorldPos.x, WorldPos.y, WorldPos.z, m_World) );
|
||||
break;
|
||||
}
|
||||
case E_BLOCK_DROPPER:
|
||||
{
|
||||
AddBlockEntity( new cDropperEntity( WorldPos.x, WorldPos.y, WorldPos.z, m_World) );
|
||||
break;
|
||||
}
|
||||
case E_BLOCK_FURNACE:
|
||||
{
|
||||
AddBlockEntity( new cFurnaceEntity( WorldPos.x, WorldPos.y, WorldPos.z, m_World) );
|
||||
@ -1835,6 +1850,50 @@ bool cChunk::ForEachDispenser(cDispenserCallback & a_Callback)
|
||||
|
||||
|
||||
|
||||
bool cChunk::ForEachDropper(cDropperCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
|
||||
{
|
||||
++itr2;
|
||||
if ((*itr)->GetBlockType() != E_BLOCK_DROPPER)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (a_Callback.Item((cDropperEntity *)*itr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // for itr - m_BlockEntitites[]
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunk::ForEachDropSpenser(cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
|
||||
{
|
||||
++itr2;
|
||||
if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (a_Callback.Item((cDropSpenserEntity *)*itr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // for itr - m_BlockEntitites[]
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
@ -1929,6 +1988,70 @@ bool cChunk::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispen
|
||||
|
||||
|
||||
|
||||
bool cChunk::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
|
||||
{
|
||||
++itr2;
|
||||
if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((*itr)->GetBlockType() != E_BLOCK_DROPPER)
|
||||
{
|
||||
// There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out
|
||||
return false;
|
||||
}
|
||||
|
||||
// The correct block entity is here
|
||||
if (a_Callback.Item((cDropperEntity *)*itr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} // for itr - m_BlockEntitites[]
|
||||
|
||||
// Not found:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunk::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
|
||||
{
|
||||
++itr2;
|
||||
if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER))
|
||||
{
|
||||
// There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out
|
||||
return false;
|
||||
}
|
||||
|
||||
// The correct block entity is here
|
||||
if (a_Callback.Item((cDropSpenserEntity *)*itr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} // for itr - m_BlockEntitites[]
|
||||
|
||||
// Not found:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback)
|
||||
{
|
||||
// The blockentity list is locked by the parent chunkmap's CS
|
||||
|
@ -191,6 +191,12 @@ public:
|
||||
/// Calls the callback for each dispenser; returns true if all dispensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDispenser(cDispenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropper; returns true if all droppers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropper(cDropperCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropspenser; returns true if all dropspensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropSpenser(cDropSpenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each furnace; returns true if all furnaces processed, false if the callback aborted by returning true
|
||||
bool ForEachFurnace(cFurnaceCallback & a_Callback); // Lua-accessible
|
||||
|
||||
@ -200,6 +206,12 @@ public:
|
||||
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found
|
||||
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible
|
||||
|
||||
|
@ -1528,6 +1528,36 @@ bool cChunkMap::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCa
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ);
|
||||
if ((Chunk == NULL) && !Chunk->IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Chunk->ForEachDropper(a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ);
|
||||
if ((Chunk == NULL) && !Chunk->IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Chunk->ForEachDropSpenser(a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
@ -1579,6 +1609,42 @@ bool cChunkMap::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDis
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback)
|
||||
{
|
||||
int ChunkX, ChunkZ;
|
||||
int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ;
|
||||
cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ);
|
||||
cCSLock Lock(m_CSLayers);
|
||||
cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||
if ((Chunk == NULL) && !Chunk->IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Chunk->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
int ChunkX, ChunkZ;
|
||||
int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ;
|
||||
cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ);
|
||||
cCSLock Lock(m_CSLayers);
|
||||
cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||
if ((Chunk == NULL) && !Chunk->IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Chunk->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkMap::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback)
|
||||
{
|
||||
int ChunkX, ChunkZ;
|
||||
|
@ -19,6 +19,8 @@ class cChunk;
|
||||
class cPlayer;
|
||||
class cChestEntity;
|
||||
class cDispenserEntity;
|
||||
class cDropperEntity;
|
||||
class cDropSpenserEntity;
|
||||
class cFurnaceEntity;
|
||||
class cPawn;
|
||||
class cPickup;
|
||||
@ -27,10 +29,12 @@ class cBlockArea;
|
||||
|
||||
typedef std::list<cClientHandle *> cClientHandleList;
|
||||
typedef cChunk * cChunkPtr;
|
||||
typedef cItemCallback<cEntity> cEntityCallback;
|
||||
typedef cItemCallback<cChestEntity> cChestCallback;
|
||||
typedef cItemCallback<cDispenserEntity> cDispenserCallback;
|
||||
typedef cItemCallback<cFurnaceEntity> cFurnaceCallback;
|
||||
typedef cItemCallback<cEntity> cEntityCallback;
|
||||
typedef cItemCallback<cChestEntity> cChestCallback;
|
||||
typedef cItemCallback<cDispenserEntity> cDispenserCallback;
|
||||
typedef cItemCallback<cDropperEntity> cDropperCallback;
|
||||
typedef cItemCallback<cDropSpenserEntity> cDropSpenserCallback;
|
||||
typedef cItemCallback<cFurnaceEntity> cFurnaceCallback;
|
||||
|
||||
|
||||
|
||||
@ -210,6 +214,12 @@ public:
|
||||
/// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropper in the specified chunk; returns true if all droppers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropspenser in the specified chunk; returns true if all dropspensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true
|
||||
bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Lua-accessible
|
||||
|
||||
@ -217,7 +227,13 @@ public:
|
||||
bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible
|
||||
|
||||
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
|
||||
bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Lua-accessible
|
||||
|
||||
/// Calls the callback for the dropper at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback); // Lua-accessible
|
||||
|
||||
/// Calls the callback for the dropspenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback); // Lua-accessible
|
||||
|
||||
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found
|
||||
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible
|
||||
|
@ -2,38 +2,15 @@
|
||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "DispenserEntity.h"
|
||||
#include "BlockID.h"
|
||||
#include "Item.h"
|
||||
#include "UI/Window.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "ClientHandle.h"
|
||||
#include "Server.h"
|
||||
#include "Pickup.h"
|
||||
#include "Root.h"
|
||||
#include "Simulator/FluidSimulator.h"
|
||||
#include <json/json.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define AddDispenserDir(x, y, z, dir) \
|
||||
switch (dir) \
|
||||
{ \
|
||||
case 2: (z) --; break; \
|
||||
case 3: (z) ++; break; \
|
||||
case 4: (x) --; break; \
|
||||
case 5: (x) ++; break; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
|
||||
super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, NULL),
|
||||
m_ShouldDispense(false)
|
||||
super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, NULL)
|
||||
{
|
||||
SetBlockEntity(this); // cBlockEntityWindowOwner
|
||||
}
|
||||
@ -43,8 +20,7 @@ cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ) :
|
||||
|
||||
|
||||
cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
|
||||
super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
|
||||
m_ShouldDispense(false)
|
||||
super(E_BLOCK_DISPENSER, a_BlockX, a_BlockY, a_BlockZ, a_World)
|
||||
{
|
||||
SetBlockEntity(this); // cBlockEntityWindowOwner
|
||||
}
|
||||
@ -53,71 +29,37 @@ cDispenserEntity::cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWo
|
||||
|
||||
|
||||
|
||||
cDispenserEntity::~cDispenserEntity()
|
||||
void cDispenserEntity::DropSpenseFromSlot(int a_SlotNum)
|
||||
{
|
||||
// Tell window its owner is destroyed
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window != NULL)
|
||||
{
|
||||
Window->OwnerDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDispenserEntity::Dispense(void)
|
||||
{
|
||||
int Disp_X = m_PosX;
|
||||
int Disp_Y = m_PosY;
|
||||
int Disp_Z = m_PosZ;
|
||||
int DispX = m_PosX;
|
||||
int DispY = m_PosY;
|
||||
int DispZ = m_PosZ;
|
||||
NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
|
||||
AddDispenserDir(Disp_X, Disp_Y, Disp_Z, Meta);
|
||||
int OccupiedSlots[9];
|
||||
int SlotsCnt = 0;
|
||||
for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--)
|
||||
{
|
||||
if (!m_Contents.GetSlot(i).IsEmpty())
|
||||
{
|
||||
OccupiedSlots[SlotsCnt] = i;
|
||||
SlotsCnt++;
|
||||
}
|
||||
} // for i - m_Contents[]
|
||||
|
||||
if (SlotsCnt == 0)
|
||||
{
|
||||
// Nothing in the dispenser, play the click sound
|
||||
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.2f);
|
||||
return;
|
||||
}
|
||||
|
||||
// Pick an item to dispense:
|
||||
MTRand r1;
|
||||
int RandomSlot = r1.randInt(SlotsCnt - 1);
|
||||
cItem & Drop = m_Contents.GetSlot(OccupiedSlots[RandomSlot]);
|
||||
AddDropSpenserDir(DispX, DispY, DispZ, Meta);
|
||||
|
||||
cItem & Drop = m_Contents.GetSlot(a_SlotNum);
|
||||
|
||||
// Dispense the item:
|
||||
switch (Drop.m_ItemType)
|
||||
{
|
||||
case E_ITEM_BUCKET:
|
||||
{
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock(Disp_X, Disp_Y, Disp_Z);
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock(DispX, DispY, DispZ);
|
||||
if (DispBlock == E_BLOCK_STATIONARY_WATER)
|
||||
{
|
||||
m_World->SetBlock(Disp_X, Disp_Y, Disp_Z, E_BLOCK_AIR, 0);
|
||||
m_World->SetBlock(DispX, DispY, DispZ, E_BLOCK_AIR, 0);
|
||||
Drop.m_ItemType = E_ITEM_WATER_BUCKET; // TODO: Duplication glitch - bucket stacking allows you to duplicate water
|
||||
}
|
||||
else if (DispBlock == E_BLOCK_STATIONARY_LAVA)
|
||||
{
|
||||
m_World->SetBlock(Disp_X, Disp_Y, Disp_Z, E_BLOCK_AIR, 0);
|
||||
m_World->SetBlock(DispX, DispY, DispZ, E_BLOCK_AIR, 0);
|
||||
Drop.m_ItemType = E_ITEM_LAVA_BUCKET; // TODO: Duplication glitch - bucket stacking allows you to duplicate lava
|
||||
}
|
||||
else
|
||||
{
|
||||
cItems Pickups;
|
||||
Pickups.push_back(Drop.CopyOne());
|
||||
m_World->SpawnItemPickups(Pickups, Disp_X, Disp_Y, Disp_Z);
|
||||
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
|
||||
Drop.m_ItemCount--;
|
||||
}
|
||||
break;
|
||||
@ -125,17 +67,17 @@ void cDispenserEntity::Dispense(void)
|
||||
|
||||
case E_ITEM_WATER_BUCKET:
|
||||
{
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock(Disp_X, Disp_Y, Disp_Z);
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock(DispX, DispY, DispZ);
|
||||
if ((DispBlock == E_BLOCK_AIR) || IsBlockLiquid(DispBlock) || cFluidSimulator::CanWashAway(DispBlock))
|
||||
{
|
||||
m_World->SetBlock(Disp_X, Disp_Y, Disp_Z, E_BLOCK_STATIONARY_WATER, 0);
|
||||
m_World->SetBlock(DispX, DispY, DispZ, E_BLOCK_STATIONARY_WATER, 0);
|
||||
Drop.m_ItemType = E_ITEM_BUCKET;
|
||||
}
|
||||
else
|
||||
{
|
||||
cItems Pickups;
|
||||
Pickups.push_back(Drop.CopyOne());
|
||||
m_World->SpawnItemPickups(Pickups, Disp_X, Disp_Y, Disp_Z);
|
||||
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
|
||||
Drop.m_ItemCount--;
|
||||
}
|
||||
break;
|
||||
@ -143,17 +85,17 @@ void cDispenserEntity::Dispense(void)
|
||||
|
||||
case E_ITEM_LAVA_BUCKET:
|
||||
{
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock( Disp_X, Disp_Y, Disp_Z );
|
||||
BLOCKTYPE DispBlock = m_World->GetBlock( DispX, DispY, DispZ );
|
||||
if ((DispBlock == E_BLOCK_AIR) || IsBlockLiquid(DispBlock) || cFluidSimulator::CanWashAway(DispBlock))
|
||||
{
|
||||
m_World->SetBlock(Disp_X, Disp_Y, Disp_Z, E_BLOCK_STATIONARY_LAVA, 0);
|
||||
m_World->SetBlock(DispX, DispY, DispZ, E_BLOCK_STATIONARY_LAVA, 0);
|
||||
Drop.m_ItemType = E_ITEM_BUCKET;
|
||||
}
|
||||
else
|
||||
{
|
||||
cItems Pickups;
|
||||
Pickups.push_back(Drop.CopyOne());
|
||||
m_World->SpawnItemPickups(Pickups, Disp_X, Disp_Y, Disp_Z);
|
||||
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
|
||||
Drop.m_ItemCount--;
|
||||
}
|
||||
break;
|
||||
@ -161,7 +103,7 @@ void cDispenserEntity::Dispense(void)
|
||||
|
||||
case E_ITEM_SPAWN_EGG:
|
||||
{
|
||||
if (m_World->SpawnMob(Disp_X + 0.5, Disp_Y, Disp_Z + 0.5, Drop.m_ItemDamage) >= 0)
|
||||
if (m_World->SpawnMob(DispX + 0.5, DispY, DispZ + 0.5, Drop.m_ItemDamage) >= 0)
|
||||
{
|
||||
Drop.m_ItemCount--;
|
||||
}
|
||||
@ -172,124 +114,14 @@ void cDispenserEntity::Dispense(void)
|
||||
{
|
||||
cItems Pickups;
|
||||
Pickups.push_back(Drop.CopyOne());
|
||||
m_World->SpawnItemPickups(Pickups, Disp_X, Disp_Y, Disp_Z);
|
||||
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
|
||||
Drop.m_ItemCount--;
|
||||
break;
|
||||
}
|
||||
} // switch (ItemType)
|
||||
|
||||
char SmokeDir = 0;
|
||||
switch (Meta)
|
||||
{
|
||||
case 2: SmokeDir = 1; break;
|
||||
case 3: SmokeDir = 7; break;
|
||||
case 4: SmokeDir = 3; break;
|
||||
case 5: SmokeDir = 5; break;
|
||||
}
|
||||
m_World->BroadcastSoundParticleEffect(2000, m_PosX * 8, m_PosY * 8, m_PosZ * 8, SmokeDir);
|
||||
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window != NULL)
|
||||
{
|
||||
Window->BroadcastWholeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDispenserEntity::UsedBy(cPlayer * a_Player)
|
||||
{
|
||||
if (GetWindow() == NULL)
|
||||
{
|
||||
OpenWindow(new cDispenserWindow(m_PosX, m_PosY, m_PosZ, this));
|
||||
}
|
||||
if (GetWindow() != NULL)
|
||||
{
|
||||
if (a_Player->GetWindow() != GetWindow())
|
||||
{
|
||||
a_Player->OpenWindow(GetWindow());
|
||||
GetWindow()->SendWholeWindow(*a_Player->GetClientHandle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDispenserEntity::Activate(void)
|
||||
{
|
||||
m_ShouldDispense = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cDispenserEntity::Tick(float a_Dt)
|
||||
{
|
||||
if (m_ShouldDispense)
|
||||
{
|
||||
m_ShouldDispense = false;
|
||||
Dispense();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cDispenserEntity::LoadFromJson(const Json::Value & a_Value)
|
||||
{
|
||||
m_PosX = a_Value.get("x", 0).asInt();
|
||||
m_PosY = a_Value.get("y", 0).asInt();
|
||||
m_PosZ = a_Value.get("z", 0).asInt();
|
||||
|
||||
Json::Value AllSlots = a_Value.get("Slots", 0);
|
||||
int SlotIdx = 0;
|
||||
for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
|
||||
{
|
||||
m_Contents.GetSlot(SlotIdx).FromJson(*itr);
|
||||
SlotIdx++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDispenserEntity::SaveToJson(Json::Value & a_Value)
|
||||
{
|
||||
a_Value["x"] = m_PosX;
|
||||
a_Value["y"] = m_PosY;
|
||||
a_Value["z"] = m_PosZ;
|
||||
|
||||
Json::Value AllSlots;
|
||||
int NumSlots = m_Contents.GetNumSlots();
|
||||
for (int i = 0; i < NumSlots; i++)
|
||||
{
|
||||
Json::Value Slot;
|
||||
m_Contents.GetSlot(i).GetJson(Slot);
|
||||
AllSlots.append(Slot);
|
||||
}
|
||||
a_Value["Slots"] = AllSlots;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDispenserEntity::SendTo(cClientHandle & a_Client)
|
||||
{
|
||||
// Nothing needs to be sent
|
||||
UNUSED(a_Client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,20 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BlockEntityWithItems.h"
|
||||
#include "UI/WindowOwner.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Json
|
||||
{
|
||||
class Value;
|
||||
}
|
||||
|
||||
class cClientHandle;
|
||||
class cServer;
|
||||
#include "DropSpenserEntity.h"
|
||||
|
||||
|
||||
|
||||
@ -22,16 +9,11 @@ class cServer;
|
||||
|
||||
// tolua_begin
|
||||
class cDispenserEntity :
|
||||
public cBlockEntityWithItems,
|
||||
public cBlockEntityWindowOwner
|
||||
public cDropSpenserEntity
|
||||
{
|
||||
typedef cBlockEntityWithItems super;
|
||||
typedef cDropSpenserEntity super;
|
||||
|
||||
public:
|
||||
enum {
|
||||
ContentsHeight = 3,
|
||||
ContentsWidth = 3,
|
||||
} ;
|
||||
|
||||
/// Constructor used while generating a chunk; sets m_World to NULL
|
||||
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
@ -40,29 +22,12 @@ public:
|
||||
|
||||
/// Constructor used for normal operation
|
||||
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
virtual ~cDispenserEntity();
|
||||
|
||||
static const char * GetClassStatic(void) { return "cDispenserEntity"; }
|
||||
|
||||
bool LoadFromJson(const Json::Value & a_Value);
|
||||
|
||||
// cBlockEntity overrides:
|
||||
virtual void SaveToJson(Json::Value & a_Value) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
virtual bool Tick(float a_Dt) override;
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/// Sets the dispenser to dispense an item in the next tick
|
||||
void Activate(void);
|
||||
|
||||
// tolua_end
|
||||
|
||||
private:
|
||||
bool m_ShouldDispense; ///< If true, the dispenser will dispense an item in the next tick
|
||||
|
||||
void Dispense(void);
|
||||
// cDropSpenser overrides:
|
||||
virtual void DropSpenseFromSlot(int a_SlotNum) override;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
212
source/DropSpenserEntity.cpp
Normal file
212
source/DropSpenserEntity.cpp
Normal file
@ -0,0 +1,212 @@
|
||||
|
||||
// DropSpenserEntity.cpp
|
||||
|
||||
// Declares the cDropSpenserEntity class representing a common ancestor to the cDispenserEntity and cDropperEntity
|
||||
// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior
|
||||
|
||||
#include "Globals.h"
|
||||
#include "DropSpenserEntity.h"
|
||||
#include "Player.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cDropSpenserEntity::cDropSpenserEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
|
||||
super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
|
||||
m_ShouldDropSpense(false)
|
||||
{
|
||||
SetBlockEntity(this); // cBlockEntityWindowOwner
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cDropSpenserEntity::~cDropSpenserEntity()
|
||||
{
|
||||
// Tell window its owner is destroyed
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window != NULL)
|
||||
{
|
||||
Window->OwnerDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & a_BlockZ, NIBBLETYPE a_Direction)
|
||||
{
|
||||
switch (a_Direction)
|
||||
{
|
||||
case E_META_DISPENSER_FACING_YM: a_BlockY--; return;
|
||||
case E_META_DISPENSER_FACING_YP: a_BlockY++; return;
|
||||
case E_META_DISPENSER_FACING_ZM: a_BlockZ--; return;
|
||||
case E_META_DISPENSER_FACING_ZP: a_BlockZ++; return;
|
||||
case E_META_DISPENSER_FACING_XM: a_BlockX--; return;
|
||||
case E_META_DISPENSER_FACING_XP: a_BlockX++; return;
|
||||
}
|
||||
LOGWARNING("%s: Unhandled direction: %d", __FUNCTION__, a_Direction);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::DropSpense(void)
|
||||
{
|
||||
int Disp_X = m_PosX;
|
||||
int Disp_Y = m_PosY;
|
||||
int Disp_Z = m_PosZ;
|
||||
NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
|
||||
|
||||
// Pick one of the occupied slots:
|
||||
int OccupiedSlots[9];
|
||||
int SlotsCnt = 0;
|
||||
for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--)
|
||||
{
|
||||
if (!m_Contents.GetSlot(i).IsEmpty())
|
||||
{
|
||||
OccupiedSlots[SlotsCnt] = i;
|
||||
SlotsCnt++;
|
||||
}
|
||||
} // for i - m_Contents[]
|
||||
|
||||
if (SlotsCnt == 0)
|
||||
{
|
||||
// Nothing in the dropspenser, play the click sound
|
||||
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.2f);
|
||||
return;
|
||||
}
|
||||
|
||||
int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
|
||||
|
||||
// DropSpense the item, using the specialized behavior in the subclasses:
|
||||
DropSpenseFromSlot(OccupiedSlots[RandomSlot]);
|
||||
|
||||
// Broadcast a smoke and click effects:
|
||||
NIBBLETYPE SmokeDir = 0;
|
||||
switch (Meta)
|
||||
{
|
||||
case 2: SmokeDir = 1; break;
|
||||
case 3: SmokeDir = 7; break;
|
||||
case 4: SmokeDir = 3; break;
|
||||
case 5: SmokeDir = 5; break;
|
||||
}
|
||||
m_World->BroadcastSoundParticleEffect(2000, m_PosX * 8, m_PosY * 8, m_PosZ * 8, SmokeDir);
|
||||
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
|
||||
|
||||
// Update the UI window, if open:
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window != NULL)
|
||||
{
|
||||
Window->BroadcastWholeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::Activate(void)
|
||||
{
|
||||
m_ShouldDropSpense = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cDropSpenserEntity::Tick(float a_Dt)
|
||||
{
|
||||
if (!m_ShouldDropSpense)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ShouldDropSpense = false;
|
||||
DropSpense();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cDropSpenserEntity::LoadFromJson(const Json::Value & a_Value)
|
||||
{
|
||||
m_PosX = a_Value.get("x", 0).asInt();
|
||||
m_PosY = a_Value.get("y", 0).asInt();
|
||||
m_PosZ = a_Value.get("z", 0).asInt();
|
||||
|
||||
Json::Value AllSlots = a_Value.get("Slots", 0);
|
||||
int SlotIdx = 0;
|
||||
for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
|
||||
{
|
||||
m_Contents.GetSlot(SlotIdx).FromJson(*itr);
|
||||
SlotIdx++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::SaveToJson(Json::Value & a_Value)
|
||||
{
|
||||
a_Value["x"] = m_PosX;
|
||||
a_Value["y"] = m_PosY;
|
||||
a_Value["z"] = m_PosZ;
|
||||
|
||||
Json::Value AllSlots;
|
||||
int NumSlots = m_Contents.GetNumSlots();
|
||||
for (int i = 0; i < NumSlots; i++)
|
||||
{
|
||||
Json::Value Slot;
|
||||
m_Contents.GetSlot(i).GetJson(Slot);
|
||||
AllSlots.append(Slot);
|
||||
}
|
||||
a_Value["Slots"] = AllSlots;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::SendTo(cClientHandle & a_Client)
|
||||
{
|
||||
// Nothing needs to be sent
|
||||
UNUSED(a_Client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropSpenserEntity::UsedBy(cPlayer * a_Player)
|
||||
{
|
||||
cWindow * Window = GetWindow();
|
||||
if (Window == NULL)
|
||||
{
|
||||
OpenWindow(new cDropSpenserWindow(m_PosX, m_PosY, m_PosZ, this));
|
||||
Window = GetWindow();
|
||||
}
|
||||
|
||||
if (Window != NULL)
|
||||
{
|
||||
if (a_Player->GetWindow() != Window)
|
||||
{
|
||||
a_Player->OpenWindow(Window);
|
||||
Window->SendWholeWindow(*a_Player->GetClientHandle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
81
source/DropSpenserEntity.h
Normal file
81
source/DropSpenserEntity.h
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
// DropSpenser.h
|
||||
|
||||
// Declares the cDropSpenser class representing a common ancestor to the cDispenserEntity and cDropperEntity
|
||||
// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BlockEntityWithItems.h"
|
||||
#include "UI/WindowOwner.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Json
|
||||
{
|
||||
class Value;
|
||||
}
|
||||
|
||||
class cClientHandle;
|
||||
class cServer;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// tolua_begin
|
||||
class cDropSpenserEntity :
|
||||
public cBlockEntityWithItems,
|
||||
public cBlockEntityWindowOwner
|
||||
{
|
||||
typedef cBlockEntityWithItems super;
|
||||
|
||||
public:
|
||||
enum {
|
||||
ContentsHeight = 3,
|
||||
ContentsWidth = 3,
|
||||
} ;
|
||||
|
||||
// tolua_end
|
||||
|
||||
cDropSpenserEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
virtual ~cDropSpenserEntity();
|
||||
|
||||
static const char * GetClassStatic(void) { return "cDropSpenserEntity"; }
|
||||
|
||||
bool LoadFromJson(const Json::Value & a_Value);
|
||||
|
||||
// cBlockEntity overrides:
|
||||
virtual void SaveToJson(Json::Value & a_Value) override;
|
||||
virtual bool Tick(float a_Dt) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/// Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should materialize)
|
||||
void AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & a_BlockZ, NIBBLETYPE a_Direction);
|
||||
|
||||
/// Sets the dropspenser to dropspense an item in the next tick
|
||||
void Activate(void);
|
||||
|
||||
// tolua_end
|
||||
|
||||
private:
|
||||
bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick
|
||||
|
||||
void DropSpense(void);
|
||||
|
||||
/// Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...)
|
||||
virtual void DropSpenseFromSlot(int a_SlotNum) = 0;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
50
source/DropperEntity.cpp
Normal file
50
source/DropperEntity.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
// DropperEntity.cpp
|
||||
|
||||
// Implements the cRtopperEntity class representing a Dropper block entity
|
||||
|
||||
#include "Globals.h"
|
||||
#include "DropperEntity.h"
|
||||
#include "Player.h"
|
||||
#include "Simulator/FluidSimulator.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
SetBlockEntity(this); // cBlockEntityWindowOwner
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cDropperEntity::DropSpenseFromSlot(int a_SlotNum)
|
||||
{
|
||||
int DispX = m_PosX;
|
||||
int DispY = m_PosY;
|
||||
int DispZ = m_PosZ;
|
||||
NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
|
||||
AddDropSpenserDir(DispX, DispY, DispZ, Meta);
|
||||
|
||||
cItems Pickups;
|
||||
Pickups.push_back(m_Contents.RemoveOneItem(a_SlotNum).CopyOne());
|
||||
m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
43
source/DropperEntity.h
Normal file
43
source/DropperEntity.h
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
// DropperEntity.h
|
||||
|
||||
// Declares the cDropperEntity class representing a dropper block entity
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DropSpenserEntity.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// tolua_begin
|
||||
class cDropperEntity :
|
||||
public cDropSpenserEntity
|
||||
{
|
||||
typedef cDropSpenserEntity super;
|
||||
|
||||
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
|
||||
cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
static const char * GetClassStatic(void) { return "cDropperEntity"; }
|
||||
|
||||
protected:
|
||||
// cDropSpenserEntity overrides:
|
||||
virtual void DropSpenseFromSlot(int a_SlotNum) override;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "ClientHandle.h"
|
||||
#include "ChestEntity.h"
|
||||
#include "DispenserEntity.h"
|
||||
#include "DropperEntity.h"
|
||||
#include "FurnaceEntity.h"
|
||||
#include "md5/md5.h"
|
||||
|
||||
@ -1174,8 +1175,11 @@ void ManualBindings::Bind( lua_State* tolua_S )
|
||||
tolua_function(tolua_S, "ForEachFurnaceInChunk", tolua_ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>);
|
||||
tolua_function(tolua_S, "DoWithPlayer", tolua_DoWith<cWorld, cPlayer, &cWorld::DoWithPlayer>);
|
||||
tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith<cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>);
|
||||
tolua_function(tolua_S, "DoWithChestAt", tolua_DoWithXYZ<cWorld, cChestEntity, &cWorld::DoWithChestAt>);
|
||||
tolua_function(tolua_S, "DoWithDispenserAt", tolua_DoWithXYZ<cWorld, cDispenserEntity, &cWorld::DoWithDispenserAt>);
|
||||
tolua_function(tolua_S, "DoWithChestAt", tolua_DoWithXYZ<cWorld, cChestEntity, &cWorld::DoWithChestAt>);
|
||||
tolua_function(tolua_S, "DoWithDispenserAt", tolua_DoWithXYZ<cWorld, cDispenserEntity, &cWorld::DoWithDispenserAt>);
|
||||
tolua_function(tolua_S, "DoWithDropperAt", tolua_DoWithXYZ<cWorld, cDropperEntity, &cWorld::DoWithDropperAt>);
|
||||
tolua_function(tolua_S, "DoWithDropSpenserAt", tolua_DoWithXYZ<cWorld, cDropSpenserEntity, &cWorld::DoWithDropSpenserAt>);
|
||||
tolua_function(tolua_S, "DoWithFurnaceAt", tolua_DoWithXYZ<cWorld, cFurnaceEntity, &cWorld::DoWithFurnaceAt>);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
||||
tolua_beginmodule(tolua_S, "cPlugin");
|
||||
|
@ -425,32 +425,27 @@ void cRedstoneSimulator::HandleChange(const Vector3i & a_BlockPos)
|
||||
} // switch (BlockType)
|
||||
} // while (m_RefreshPistons[])
|
||||
|
||||
while (!m_RefreshDispensers.empty())
|
||||
while (!m_RefreshDropSpensers.empty())
|
||||
{
|
||||
Vector3i pos = m_RefreshDispensers.back();
|
||||
m_RefreshDispensers.pop_back();
|
||||
Vector3i pos = m_RefreshDropSpensers.back();
|
||||
m_RefreshDropSpensers.pop_back();
|
||||
|
||||
BLOCKTYPE BlockType = m_World.GetBlock(pos);
|
||||
if (BlockType == E_BLOCK_DISPENSER)
|
||||
if ((BlockType == E_BLOCK_DISPENSER) || (BlockType == E_BLOCK_DROPPER))
|
||||
{
|
||||
if (IsPowered(pos))
|
||||
{
|
||||
class cActivateDispenser :
|
||||
public cDispenserCallback
|
||||
class cActivateDropSpenser :
|
||||
public cDropSpenserCallback
|
||||
{
|
||||
public:
|
||||
cActivateDispenser()
|
||||
virtual bool Item(cDropSpenserEntity * a_DropSpenser) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool Item(cDispenserEntity * a_Dispenser) override
|
||||
{
|
||||
a_Dispenser->Activate();
|
||||
a_DropSpenser->Activate();
|
||||
return false;
|
||||
}
|
||||
} ;
|
||||
cActivateDispenser DispAct;
|
||||
m_World.DoWithDispenserAt(pos.x, pos.y, pos.z, DispAct);
|
||||
cActivateDropSpenser DrSpAct;
|
||||
m_World.DoWithDropSpenserAt(pos.x, pos.y, pos.z, DrSpAct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -485,8 +480,9 @@ bool cRedstoneSimulator::PowerBlock(const Vector3i & a_BlockPos, const Vector3i
|
||||
}
|
||||
|
||||
case E_BLOCK_DISPENSER:
|
||||
case E_BLOCK_DROPPER:
|
||||
{
|
||||
m_RefreshDispensers.push_back(a_BlockPos);
|
||||
m_RefreshDropSpensers.push_back(a_BlockPos);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ private:
|
||||
BlockList m_BlocksBuffer;
|
||||
|
||||
BlockList m_RefreshPistons;
|
||||
BlockList m_RefreshDispensers;
|
||||
BlockList m_RefreshDropSpensers;
|
||||
|
||||
BlockList m_RefreshTorchesAround;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "SlotArea.h"
|
||||
#include "../Player.h"
|
||||
#include "../ChestEntity.h"
|
||||
#include "../DispenserEntity.h"
|
||||
#include "../DropSpenserEntity.h"
|
||||
#include "../FurnaceEntity.h"
|
||||
#include "../Items/ItemHandler.h"
|
||||
#include "Window.h"
|
||||
@ -474,11 +474,11 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cSlotAreaFurnace:
|
||||
// cSlotAreaDropSpenser:
|
||||
|
||||
cSlotAreaDispenser::cSlotAreaDispenser(cDispenserEntity * a_Dispenser, cWindow & a_ParentWindow) :
|
||||
cSlotAreaDropSpenser::cSlotAreaDropSpenser(cDropSpenserEntity * a_DropSpenser, cWindow & a_ParentWindow) :
|
||||
cSlotArea(9, a_ParentWindow),
|
||||
m_Dispenser(a_Dispenser)
|
||||
m_DropSpenser(a_DropSpenser)
|
||||
{
|
||||
}
|
||||
|
||||
@ -486,34 +486,18 @@ cSlotAreaDispenser::cSlotAreaDispenser(cDispenserEntity * a_Dispenser, cWindow &
|
||||
|
||||
|
||||
|
||||
void cSlotAreaDispenser::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem)
|
||||
const cItem * cSlotAreaDropSpenser::GetSlot(int a_SlotNum, cPlayer & a_Player)
|
||||
{
|
||||
super::Clicked(a_Player, a_SlotNum, a_ClickAction, a_ClickedItem);
|
||||
|
||||
if (m_Dispenser == NULL)
|
||||
{
|
||||
LOGERROR("cSlotAreaDispenser::Clicked(): m_Dispenser == NULL");
|
||||
ASSERT(!"cSlotAreaDispenser::Clicked(): m_Dispenser == NULL");
|
||||
return;
|
||||
}
|
||||
return &(m_DropSpenser->GetSlot(a_SlotNum));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const cItem * cSlotAreaDispenser::GetSlot(int a_SlotNum, cPlayer & a_Player)
|
||||
void cSlotAreaDropSpenser::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item)
|
||||
{
|
||||
return &(m_Dispenser->GetSlot(a_SlotNum));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cSlotAreaDispenser::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item)
|
||||
{
|
||||
m_Dispenser->SetSlot(a_SlotNum, a_Item);
|
||||
m_DropSpenser->SetSlot(a_SlotNum, a_Item);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
class cWindow;
|
||||
class cPlayer;
|
||||
class cChestEntity;
|
||||
class cDispenserEntity;
|
||||
class cDropSpenserEntity;
|
||||
class cFurnaceEntity;
|
||||
class cCraftingRecipe;
|
||||
|
||||
@ -250,20 +250,19 @@ protected:
|
||||
|
||||
|
||||
|
||||
class cSlotAreaDispenser :
|
||||
class cSlotAreaDropSpenser :
|
||||
public cSlotArea
|
||||
{
|
||||
typedef cSlotArea super;
|
||||
|
||||
public:
|
||||
cSlotAreaDispenser(cDispenserEntity * a_Dispenser, cWindow & a_ParentWindow);
|
||||
cSlotAreaDropSpenser(cDropSpenserEntity * a_DropSpenser, cWindow & a_ParentWindow);
|
||||
|
||||
virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
|
||||
virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) override;
|
||||
virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override;
|
||||
|
||||
protected:
|
||||
cDispenserEntity * m_Dispenser;
|
||||
cDropSpenserEntity * m_DropSpenser;
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -482,12 +482,12 @@ cChestWindow::~cChestWindow()
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cDispenserWindow:
|
||||
// cDropSpenserWindow:
|
||||
|
||||
cDispenserWindow::cDispenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserEntity * a_Dispenser) :
|
||||
cWindow(cWindow::Dispenser, "MCS-Dispenser")
|
||||
cDropSpenserWindow::cDropSpenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserEntity * a_DropSpenser) :
|
||||
cWindow(cWindow::DropSpenser, "MCS-DropSpenser")
|
||||
{
|
||||
m_SlotAreas.push_back(new cSlotAreaDispenser(a_Dispenser, *this));
|
||||
m_SlotAreas.push_back(new cSlotAreaDropSpenser(a_DropSpenser, *this));
|
||||
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
|
||||
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class cPlayer;
|
||||
class cWindowOwner;
|
||||
class cClientHandle;
|
||||
class cChestEntity;
|
||||
class cDispenserEntity;
|
||||
class cDropSpenserEntity;
|
||||
class cFurnaceEntity;
|
||||
class cSlotArea;
|
||||
class cWorld;
|
||||
@ -49,9 +49,13 @@ public:
|
||||
Chest = 0,
|
||||
Workbench = 1,
|
||||
Furnace = 2,
|
||||
Dispenser = 3,
|
||||
DropSpenser = 3, // Dropper or Dispenser
|
||||
Enchantment = 4,
|
||||
Brewery = 5
|
||||
Brewery = 5,
|
||||
NPCTrade = 6,
|
||||
Beacon = 7,
|
||||
Anvil = 8,
|
||||
Hopper = 9,
|
||||
};
|
||||
|
||||
static const int c_NumInventorySlots = 36;
|
||||
@ -149,11 +153,11 @@ public:
|
||||
|
||||
|
||||
|
||||
class cDispenserWindow :
|
||||
class cDropSpenserWindow :
|
||||
public cWindow
|
||||
{
|
||||
public:
|
||||
cDispenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserEntity * a_Dispenser);
|
||||
cDropSpenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserEntity * a_Dispenser);
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -694,6 +694,24 @@ bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallb
|
||||
|
||||
|
||||
|
||||
bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->ForEachDropperInChunk(a_ChunkX, a_ChunkZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->ForEachDropSpenserInChunk(a_ChunkX, a_ChunkZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->ForEachFurnaceInChunk(a_ChunkX, a_ChunkZ, a_Callback);
|
||||
@ -758,6 +776,24 @@ bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispen
|
||||
|
||||
|
||||
|
||||
bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
|
@ -339,6 +339,12 @@ public:
|
||||
/// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropper in the specified chunk; returns true if all droppers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each dropspenser in the specified chunk; returns true if all dropspensers processed, false if the callback aborted by returning true
|
||||
bool ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback);
|
||||
|
||||
/// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true
|
||||
bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
@ -349,7 +355,13 @@ public:
|
||||
bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
/// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback);
|
||||
bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
/// Calls the callback for the dropper at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
/// Calls the callback for the dropspenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found
|
||||
bool DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
/// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found
|
||||
bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "../BlockID.h"
|
||||
#include "../ChestEntity.h"
|
||||
#include "../DispenserEntity.h"
|
||||
#include "../DropperEntity.h"
|
||||
#include "../FurnaceEntity.h"
|
||||
#include "../SignEntity.h"
|
||||
#include "../NoteEntity.h"
|
||||
@ -132,6 +133,20 @@ void cNBTChunkSerializer::AddDispenserEntity(cDispenserEntity * a_Entity)
|
||||
|
||||
|
||||
|
||||
void cNBTChunkSerializer::AddDropperEntity(cDropperEntity * a_Entity)
|
||||
{
|
||||
m_Writer.BeginCompound("");
|
||||
AddBasicTileEntity(a_Entity, "Dropper");
|
||||
m_Writer.BeginList("Items", TAG_Compound);
|
||||
AddItemGrid(a_Entity->GetContents());
|
||||
m_Writer.EndList();
|
||||
m_Writer.EndCompound();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cNBTChunkSerializer::AddFurnaceEntity(cFurnaceEntity * a_Furnace)
|
||||
{
|
||||
m_Writer.BeginCompound("");
|
||||
@ -401,6 +416,7 @@ void cNBTChunkSerializer::BlockEntity(cBlockEntity * a_Entity)
|
||||
{
|
||||
case E_BLOCK_CHEST: AddChestEntity ((cChestEntity *) a_Entity); break;
|
||||
case E_BLOCK_DISPENSER: AddDispenserEntity ((cDispenserEntity *) a_Entity); break;
|
||||
case E_BLOCK_DROPPER: AddDropperEntity ((cDropperEntity *) a_Entity); break;
|
||||
case E_BLOCK_FURNACE: AddFurnaceEntity ((cFurnaceEntity *) a_Entity); break;
|
||||
case E_BLOCK_SIGN_POST:
|
||||
case E_BLOCK_WALLSIGN: AddSignEntity ((cSignEntity *) a_Entity); break;
|
||||
|
@ -22,6 +22,7 @@ class cBlockEntity;
|
||||
class cChestEntity;
|
||||
class cFurnaceEntity;
|
||||
class cDispenserEntity;
|
||||
class cDropperEntity;
|
||||
class cSignEntity;
|
||||
class cNoteEntity;
|
||||
class cJukeboxEntity;
|
||||
@ -80,6 +81,7 @@ protected:
|
||||
void AddBasicTileEntity(cBlockEntity * a_Entity, const char * a_EntityTypeID);
|
||||
void AddChestEntity(cChestEntity * a_Entity);
|
||||
void AddDispenserEntity(cDispenserEntity * a_Entity);
|
||||
void AddDropperEntity(cDropperEntity * a_Entity);
|
||||
void AddFurnaceEntity(cFurnaceEntity * a_Furnace);
|
||||
void AddSignEntity(cSignEntity * a_Sign);
|
||||
void AddNoteEntity(cNoteEntity * a_Note);
|
||||
|
@ -74,6 +74,7 @@ void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity)
|
||||
{
|
||||
case E_BLOCK_CHEST: SaveInto = "Chests"; break;
|
||||
case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; break;
|
||||
case E_BLOCK_DROPPER: SaveInto = "Droppers"; break;
|
||||
case E_BLOCK_FURNACE: SaveInto = "Furnaces"; break;
|
||||
case E_BLOCK_SIGN_POST: SaveInto = "Signs"; break;
|
||||
case E_BLOCK_WALLSIGN: SaveInto = "Signs"; break;
|
||||
|
Loading…
Reference in New Issue
Block a user