36 m_BlockType(a_BlockType),
37 m_BlockMeta(a_BlockMeta),
83 case E_BLOCK_WALL_BANNER:
return std::make_unique<cBannerEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
86 case E_BLOCK_BEACON:
return std::make_unique<cBeaconEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
87 case E_BLOCK_BED:
return std::make_unique<cBedEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
88 case E_BLOCK_BREWING_STAND:
return std::make_unique<cBrewingstandEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
89 case E_BLOCK_CHEST:
return std::make_unique<cChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
90 case E_BLOCK_COMMAND_BLOCK:
return std::make_unique<cCommandBlockEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
91 case E_BLOCK_DISPENSER:
return std::make_unique<cDispenserEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
92 case E_BLOCK_DROPPER:
return std::make_unique<cDropperEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
93 case E_BLOCK_ENCHANTMENT_TABLE:
return std::make_unique<cEnchantingTableEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
94 case E_BLOCK_ENDER_CHEST:
return std::make_unique<cEnderChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
95 case E_BLOCK_END_PORTAL:
return std::make_unique<cEndPortalEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
96 case E_BLOCK_FLOWER_POT:
return std::make_unique<cFlowerPotEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
97 case E_BLOCK_FURNACE:
return std::make_unique<cFurnaceEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
98 case E_BLOCK_HEAD:
return std::make_unique<cMobHeadEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
99 case E_BLOCK_HOPPER:
return std::make_unique<cHopperEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
100 case E_BLOCK_JUKEBOX:
return std::make_unique<cJukeboxEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
101 case E_BLOCK_LIT_FURNACE:
return std::make_unique<cFurnaceEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
102 case E_BLOCK_MOB_SPAWNER:
return std::make_unique<cMobSpawnerEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
103 case E_BLOCK_NOTE_BLOCK:
return std::make_unique<cNoteEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
104 case E_BLOCK_SIGN_POST:
return std::make_unique<cSignEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
105 case E_BLOCK_TRAPPED_CHEST:
return std::make_unique<cChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
106 case E_BLOCK_WALLSIGN:
return std::make_unique<cSignEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
109 LOGD(
"%s: Requesting creation of an unknown block entity - block type %d (%s)",
112 ASSERT(!
"Requesting creation of an unknown block entity");
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
@ E_BLOCK_STANDING_BANNER
@ E_BLOCK_ENCHANTMENT_TABLE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
#define FAST_FLOOR_DIV(x, div)
Faster than (int)floorf((float)x / (float)div)
BLOCKTYPE m_BlockType
The blocktype representing this particular instance in the world.
NIBBLETYPE m_BlockMeta
The block meta representing this particular instance in the world Mainly used for directional entitie...
virtual void Destroy()
Called when this block entity's associated block is destroyed.
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking.
static OwnedBlockEntity CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World=nullptr)
Creates a new block entity for the specified block type at the specified absolute pos.
void SetWorld(cWorld *a_World)
virtual cItems ConvertToPickups() const
Returns the contents of this block entity that it would drop if broken.
void SetPos(Vector3i a_NewPos)
Updates the internally stored position.
virtual void OnRemoveFromWorld()
Called when the block entity object is removed from a world.
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Vector3i m_Pos
Position in absolute block coordinates.
static bool IsBlockEntityBlockType(BLOCKTYPE a_BlockType)
Returns true if the specified blocktype is supposed to have an associated block entity.
virtual void CopyFrom(const cBlockEntity &a_Src)
Copies all properties of a_Src into this entity, except for its m_World and location.
virtual void OnAddToWorld(cWorld &a_World, cChunk &a_Chunk)
Called when the block entity object is added to a world.
OwnedBlockEntity Clone(Vector3i a_Pos)
Makes an exact copy of this block entity, except for its m_World (set to nullptr),...
Constants used throughout the code, useful typedefs and utility functions.
This class bridges a vector of cItem for safe access via Lua.
std::unique_ptr< cBlockEntity > OwnedBlockEntity