diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-09-01 13:04:50 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-09-01 13:04:50 +0200 |
commit | 496c337cdfa593654018c171f6a74c28272265b5 (patch) | |
tree | fab48316d8fd6de97500ca1b8c8c5792eb578acc /src/Blocks/BlockMobHead.h | |
parent | Update Core plugin (diff) | |
download | cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.gz cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.bz2 cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.lz cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.xz cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.zst cuberite-496c337cdfa593654018c171f6a74c28272265b5.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockMobHead.h | 22 |
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 |