summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockMobHead.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-11 23:20:49 +0200
committerMattes D <github@xoft.cz>2017-09-11 23:20:49 +0200
commite225b7f8262df48ad4d7094bc295add3007b0649 (patch)
treea42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/Blocks/BlockMobHead.h
parentcBlockArea: change MakeIndex to return size_t (diff)
downloadcuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip
Diffstat (limited to '')
-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