1
0
Fork 0

Remove BLOCKENTITY_PROTODEF

This commit is contained in:
Tiger Wang 2020-10-20 12:28:45 +01:00
parent c11ca96c3d
commit 6d85435f60
21 changed files with 10 additions and 153 deletions

View File

@ -16,18 +16,15 @@
// tolua_begin
class cBeaconEntity:
class cBeaconEntity :
public cBlockEntityWithItems
{
// tolua_end
using Super = cBlockEntityWithItems;
public: // tolua_export
BLOCKENTITY_PROTODEF(cBeaconEntity)
cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// cBlockEntity overrides:
@ -77,12 +74,9 @@ public: // tolua_export
// tolua_end
protected:
bool m_IsActive;
char m_BeaconLevel;
cEntityEffect::eType m_PrimaryEffect, m_SecondaryEffect;
} ; // tolua_export

View File

@ -12,7 +12,7 @@
// tolua_begin
class cBedEntity:
class cBedEntity :
public cBlockEntity
{
// tolua_end
@ -20,8 +20,6 @@ class cBedEntity:
public: // tolua_export
BLOCKENTITY_PROTODEF(cBedEntity)
cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, short a_Color = E_META_WOOL_RED);
// tolua_begin
@ -44,5 +42,6 @@ public: // tolua_export
virtual void SendTo(cClientHandle & a_Client) override;
private:
short m_Color;
}; // tolua_export

View File

@ -5,27 +5,6 @@
/** Place this macro in the declaration of each cBlockEntity descendant. */
#define BLOCKENTITY_PROTODEF(classname) \
virtual bool IsA(const char * a_ClassName) const override \
{ \
return ((a_ClassName != nullptr) && ((strcmp(a_ClassName, #classname) == 0) || Super::IsA(a_ClassName))); \
} \
virtual const char * GetClass() const override \
{ \
return #classname; \
} \
static const char * GetClassStatic() \
{ \
return #classname; \
} \
virtual const char * GetParentClass() const override \
{ \
return Super::GetClass(); \
}
class cChunk;
@ -56,6 +35,7 @@ protected:
}
public:
// tolua_end
virtual ~cBlockEntity() {} // force a virtual destructor in all descendants
@ -93,20 +73,6 @@ public:
Super::CopyFrom(a_Src) to copy the common ones. */
virtual void CopyFrom(const cBlockEntity & a_Src);
static const char * GetClassStatic() // Needed for ManualBindings's ForEach templates
{
return "cBlockEntity";
}
/** Returns true if the object is the specified class, or its descendant. */
virtual bool IsA(const char * a_ClassName) const { return (strcmp(a_ClassName, "cBlockEntity") == 0); }
/** Returns the name of the topmost class (the most descendant). Used for Lua bindings to push the correct object type. */
virtual const char * GetClass() const { return GetClassStatic(); }
/** Returns the name of the parent class, or empty string if no parent class. */
virtual const char * GetParentClass() const { return ""; }
// tolua_begin
// Position, in absolute block coordinates:
@ -163,7 +129,3 @@ protected:
cWorld * m_World;
} ; // tolua_export

View File

@ -32,9 +32,6 @@ class cBlockEntityWithItems :
public: // tolua_export
BLOCKENTITY_PROTODEF(cBlockEntityWithItems)
cBlockEntityWithItems(
BLOCKTYPE a_BlockType, // Type of the block that the entity represents
NIBBLETYPE a_BlockMeta, // Meta of the block that the entity represents
@ -64,12 +61,9 @@ public: // tolua_export
const cItemGrid & GetContents(void) const { return m_Contents; }
protected:
cItemGrid m_Contents;
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override;
} ; // tolua_export

View File

@ -40,8 +40,6 @@ public:
// tolua_end
BLOCKENTITY_PROTODEF(cBrewingstandEntity)
/** Constructor used for normal operation */
cBrewingstandEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -144,10 +142,4 @@ protected:
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
} ; // tolua_export

View File

@ -34,8 +34,6 @@ public:
// tolua_end
BLOCKENTITY_PROTODEF(cChestEntity)
/** Constructor used for normal operation */
cChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -64,7 +62,6 @@ public:
/** Sets the number of players who currently have this chest open */
void SetNumberOfPlayers(int a_NumActivePlayers) { m_NumActivePlayers = a_NumActivePlayers; }
private:
/** Number of players who currently have this chest open */
@ -75,9 +72,4 @@ private:
/** cItemGrid::cListener overrides: */
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override;
} ; // tolua_export

View File

@ -26,8 +26,6 @@ class cCommandBlockEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cCommandBlockEntity)
/** Creates a new empty command block entity */
cCommandBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -73,7 +71,3 @@ private:
NIBBLETYPE m_Result;
} ; // tolua_export

View File

@ -17,8 +17,6 @@ class cDispenserEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cDispenserEntity)
/** Constructor used for normal operation */
cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -54,6 +52,7 @@ public: // tolua_export
// tolua_end
private:
// cDropSpenser overrides:
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
@ -64,6 +63,3 @@ private:
does the m_Contents processing and returns true. Returns false otherwise. */
bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum);
} ; // tolua_export

View File

@ -42,8 +42,6 @@ public:
// tolua_end
BLOCKENTITY_PROTODEF(cDropSpenserEntity)
cDropSpenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
virtual ~cDropSpenserEntity() override;
@ -64,6 +62,7 @@ public:
// tolua_end
protected:
bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick
/** Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke / sound effects */
@ -75,7 +74,3 @@ protected:
/** Helper function, drops one item from the specified slot (like a dropper) */
void DropFromSlot(cChunk & a_Chunk, int a_SlotNum);
} ; // tolua_export

View File

@ -25,18 +25,11 @@ class cDropperEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cDropperEntity)
/** Constructor used for normal operation */
cDropperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
protected:
// cDropSpenserEntity overrides:
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
} ; // tolua_export

View File

@ -14,8 +14,6 @@ class cEnchantingTableEntity :
public:
BLOCKENTITY_PROTODEF(cEnchantingTableEntity)
cEnchantingTableEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, AString a_CustomName = "");
const AString & GetCustomName() const { return m_CustomName; }

View File

@ -14,8 +14,6 @@ class cEndPortalEntity :
public:
BLOCKENTITY_PROTODEF(cEndPortalEntity)
cEndPortalEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
private:

View File

@ -19,8 +19,6 @@ class cEnderChestEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cEnderChestEntity)
cEnderChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
virtual ~cEnderChestEntity() override;
@ -34,7 +32,3 @@ public: // tolua_export
/** Opens a new enderchest window for this enderchest */
void OpenNewWindow(void);
} ; // tolua_export

View File

@ -16,7 +16,6 @@
// tolua_begin
class cFlowerPotEntity :
public cBlockEntity
{
@ -26,8 +25,6 @@ class cFlowerPotEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cFlowerPotEntity)
/** Creates a new flowerpot entity at the specified block coords. a_World may be nullptr */
cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -57,7 +54,3 @@ private:
cItem m_Item;
} ; // tolua_export

View File

@ -38,8 +38,6 @@ public:
// tolua_end
BLOCKENTITY_PROTODEF(cFurnaceEntity)
/** Constructor used for normal operation */
cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -175,7 +173,3 @@ protected:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
} ; // tolua_export

View File

@ -26,6 +26,7 @@ class cHopperEntity :
// tolua_begin
public:
enum
{
ContentsHeight = 1,
@ -33,12 +34,8 @@ public:
TICKS_PER_TRANSFER = 8, ///< How many ticks at minimum between two item transfers to or from the hopper
} ;
// tolua_end
BLOCKENTITY_PROTODEF(cHopperEntity)
/** Constructor used for normal operation */
cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -100,7 +97,3 @@ private:
bool m_Locked;
} ; // tolua_export

View File

@ -19,8 +19,6 @@ class cJukeboxEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cJukeboxEntity)
cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// tolua_begin
@ -55,7 +53,3 @@ public: // tolua_export
private:
int m_Record;
} ; // tolua_end

View File

@ -27,8 +27,6 @@ class cMobHeadEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cMobHeadEntity)
/** Creates a new mob head entity at the specified block coords. a_World may be nullptr */
cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -85,7 +83,3 @@ private:
AString m_OwnerTexture;
AString m_OwnerTextureSignature;
} ; // tolua_export

View File

@ -33,7 +33,6 @@ public: // tolua_export
virtual bool UsedBy(cPlayer * a_Player) override;
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
static const char * GetClassStatic(void) { return "cMobSpawnerEntity"; }
// tolua_begin
/** Update the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function. */
@ -71,6 +70,7 @@ public: // tolua_export
// tolua_end
private:
/** The entity to spawn. */
eMonsterType m_Entity;
@ -96,7 +96,3 @@ private:
short m_RequiredPlayerRange = 16;
} ; // tolua_end

View File

@ -36,8 +36,6 @@ class cNoteEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cNoteEntity)
/** Creates a new note entity. a_World may be nullptr */
cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);

View File

@ -25,8 +25,6 @@ class cSignEntity :
public: // tolua_export
BLOCKENTITY_PROTODEF(cSignEntity)
/** Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr */
cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@ -52,7 +50,3 @@ private:
AString m_Line[4];
} ; // tolua_export