From 502935c061ea913180f0a77a7406f5292e697c79 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 6 Apr 2013 21:21:57 +0000 Subject: Mineshafts: Added random loot to generated chests and fixed chest direction git-svn-id: http://mc-server.googlecode.com/svn/trunk@1365 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ChestEntity.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'source/ChestEntity.h') diff --git a/source/ChestEntity.h b/source/ChestEntity.h index cef53f037..03102a80b 100644 --- a/source/ChestEntity.h +++ b/source/ChestEntity.h @@ -16,18 +16,26 @@ namespace Json class cClientHandle; class cServer; class cItem; +class cLootProbab; class cNBTData; -class cChestEntity : // tolua_export - public cBlockEntity, // tolua_export - public cBlockEntityWindowOwner // tolua_export -{ // tolua_export +// tolua_begin +class cChestEntity : + public cBlockEntity, + public cBlockEntityWindowOwner +{ + typedef cBlockEntity super; + public: + cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ); // Used while generating + // tolua_end + cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); + virtual ~cChestEntity(); virtual void Destroy(); @@ -35,6 +43,11 @@ public: const cItem * GetSlot(int a_Slot) const; // tolua_export void SetSlot(int a_Slot, const cItem & a_Item ); // tolua_export + + /** Generates random loot from the specified loot probability table, with a chance of enchanted books added. + A total of a_NumSlots are taken by the loot + */ + void GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, int a_CountLootProbabs, int a_NumSlots, int a_Seed); bool LoadFromJson( const Json::Value& a_Value ); @@ -53,8 +66,8 @@ public: private: - cItem * m_Content; -}; // tolua_export + cItem m_Content[c_ChestWidth * c_ChestHeight]; // TODO: replace this by a generic ItemGridHolder +} ; // tolua_export -- cgit v1.2.3