24 int a_BlockX,
int a_BlockY,
int a_BlockZ,
eBlockFace a_BlockFace,
25 int a_CursorX,
int a_CursorY,
int a_CursorZ
29 int PlacedBlockX = a_BlockX;
30 int PlacedBlockY = a_BlockY;
31 int PlacedBlockZ = a_BlockZ;
33 if (
TrySpawnGolem(a_World, a_Player, PlacedBlockX, PlacedBlockY, PlacedBlockZ))
41 return super::OnPlayerPlace(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
56 switch (a_World.
GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))
82 AirBlocks.emplace_back(a_BlockX, a_BlockY, a_BlockZ,
E_BLOCK_AIR, 0);
83 AirBlocks.emplace_back(a_BlockX, a_BlockY - 1, a_BlockZ,
E_BLOCK_AIR, 0);
84 AirBlocks.emplace_back(a_BlockX, a_BlockY - 2, a_BlockZ,
E_BLOCK_AIR, 0);
91 a_World.
SpawnMob(static_cast<double>(a_BlockX) + 0.5, a_BlockY - 2, static_cast<double>(a_BlockZ) + 0.5,
mtSnowGolem,
false);
108 static const Vector3i ArmOffsets[] =
113 for (
size_t i = 0; i <
ARRAYCOUNT(ArmOffsets); i++)
126 AirBlocks.emplace_back(a_BlockX, a_BlockY, a_BlockZ,
E_BLOCK_AIR, 0);
127 AirBlocks.emplace_back(a_BlockX, a_BlockY - 1, a_BlockZ,
E_BLOCK_AIR, 0);
128 AirBlocks.emplace_back(a_BlockX, a_BlockY - 2, a_BlockZ,
E_BLOCK_AIR, 0);
129 AirBlocks.emplace_back(a_BlockX + ArmOffsets[i].x, a_BlockY - 1, a_BlockZ + ArmOffsets[i].z,
E_BLOCK_AIR, 0);
130 AirBlocks.emplace_back(a_BlockX - ArmOffsets[i].x, a_BlockY - 1, a_BlockZ - ArmOffsets[i].z,
E_BLOCK_AIR, 0);
137 a_World.
SpawnMob(static_cast<double>(a_BlockX) + 0.5, a_BlockY - 2, static_cast<double>(a_BlockZ) + 0.5,
mtIronGolem,
false);
virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby=false) override
Spawns a mob of the specified type.
BLOCKTYPE GetBlock(Vector3i a_BlockPos)
Returns the block type at the specified position.
void SendBlocksAround(int a_BlockX, int a_BlockY, int a_BlockZ, int a_Range=1)
Sends the block in the specified range around the specified coord to the client as a block change pac...
bool TrySpawnIronGolem(cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
Spawns an iron golem if the shape matches the recipe, supposing that the block placed at the specifie...
bool PlaceBlocks(const sSetBlockVector &a_Blocks)
Calls the block placement hooks and places the blocks in the world.
void AddFaceDirection(int &a_BlockX, int &a_BlockY, int &a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse=false)
virtual bool OnPlayerPlace(cWorld &a_World, cPlayer &a_Player, const cItem &a_EquippedItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
Called when the player tries to place the item (right mouse button, IsPlaceable() == true)...
bool TrySpawnSnowGolem(cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
Spawns a snow golem if the shape matches the recipe, supposing that the block placed at the specified...
virtual bool OnPlayerPlace(cWorld &a_World, cPlayer &a_Player, const cItem &a_EquippedItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
Called when the player tries to place the item (right mouse button, IsPlaceable() == true)...
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
bool TrySpawnGolem(cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
Spawns a snow / iron golem if the shape matches the recipe, supposing that the block placed at the sp...
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
cItemPumpkinHandler(void)
std::vector< sSetBlock > sSetBlockVector