summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockMobHead.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 09:45:06 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-02 09:50:23 +0200
commit49c443896dcac8c4eaf08c4024e8bd2366ad899a (patch)
treeb1ec46cab2b4e5731860c7136f1bbfca6fe9d458 /src/Blocks/BlockMobHead.h
parentSetSwimState now takes into account head height (diff)
downloadcuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.gz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.bz2
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.lz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.xz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.zst
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockMobHead.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h
index 764cd7f65..30aba2491 100644
--- a/src/Blocks/BlockMobHead.h
+++ b/src/Blocks/BlockMobHead.h
@@ -30,32 +30,36 @@ public:
return;
}
- a_WorldInterface.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, [](cBlockEntity & a_BlockEntity)
+ class cCallback : public cBlockEntityCallback
+ {
+ virtual bool Item(cBlockEntity * a_BlockEntity)
{
- if (a_BlockEntity.GetBlockType() != E_BLOCK_HEAD)
+ if (a_BlockEntity->GetBlockType() != E_BLOCK_HEAD)
{
return false;
}
- auto & MobHeadEntity = static_cast<cMobHeadEntity&>(a_BlockEntity);
+ cMobHeadEntity * 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