summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockMobHead.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockMobHead.h')
-rw-r--r--src/Blocks/BlockMobHead.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h
index 30aba2491..764cd7f65 100644
--- a/src/Blocks/BlockMobHead.h
+++ b/src/Blocks/BlockMobHead.h
@@ -30,36 +30,32 @@ public:
return;
}
- class cCallback : public cBlockEntityCallback
- {
- virtual bool Item(cBlockEntity * a_BlockEntity)
+ a_WorldInterface.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, [](cBlockEntity & a_BlockEntity)
{
- if (a_BlockEntity->GetBlockType() != E_BLOCK_HEAD)
+ if (a_BlockEntity.GetBlockType() != E_BLOCK_HEAD)
{
return false;
}
- cMobHeadEntity * MobHeadEntity = static_cast<cMobHeadEntity*>(a_BlockEntity);
+ auto & MobHeadEntity = static_cast<cMobHeadEntity&>(a_BlockEntity);
cItems Pickups;
- Pickups.Add(E_ITEM_HEAD, 1, static_cast<short>(MobHeadEntity->GetType()));
+ Pickups.Add(E_ITEM_HEAD, 1, static_cast<short>(MobHeadEntity.GetType()));
auto & r1 = GetRandomProvider();
// Mid-block position first
double MicroX, MicroY, MicroZ;
- MicroX = MobHeadEntity->GetPosX() + 0.5;
- MicroY = MobHeadEntity->GetPosY() + 0.5;
- MicroZ = MobHeadEntity->GetPosZ() + 0.5;
+ MicroX = MobHeadEntity.GetPosX() + 0.5;
+ MicroY = MobHeadEntity.GetPosY() + 0.5;
+ MicroZ = MobHeadEntity.GetPosZ() + 0.5;
// Add random offset second
MicroX += r1.RandReal<double>(-0.5, 0.5);
MicroZ += r1.RandReal<double>(-0.5, 0.5);
- MobHeadEntity->GetWorld()->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ);
+ MobHeadEntity.GetWorld()->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ);
return false;
}
- } Callback;
-
- a_WorldInterface.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
+ );
}
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override