diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-02 15:09:07 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-02 15:09:07 +0100 |
commit | 96cd7d65a3823048bd7d59e99ca3406cf0031a55 (patch) | |
tree | c33f3f7efd51b8f8187f8c10e92a3fa43c3659eb /source | |
parent | Multiple fixes (diff) | |
download | cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar.gz cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar.bz2 cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar.lz cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar.xz cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.tar.zst cuberite-96cd7d65a3823048bd7d59e99ca3406cf0031a55.zip |
Diffstat (limited to '')
-rw-r--r-- | source/BlockEntities/DropSpenserEntity.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/BlockEntities/DropSpenserEntity.cpp b/source/BlockEntities/DropSpenserEntity.cpp index a9fcdab17..25def9999 100644 --- a/source/BlockEntities/DropSpenserEntity.cpp +++ b/source/BlockEntities/DropSpenserEntity.cpp @@ -89,6 +89,8 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk) int SmokeDir = 0; switch (Meta) { + case E_META_DROPSPENSER_FACING_YP: SmokeDir = 4; break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block) + case E_META_DROPSPENSER_FACING_YM: SmokeDir = 4; break; case E_META_DROPSPENSER_FACING_XM: SmokeDir = 3; break; case E_META_DROPSPENSER_FACING_XP: SmokeDir = 5; break; case E_META_DROPSPENSER_FACING_ZM: SmokeDir = 1; break; @@ -237,7 +239,26 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum) cItems Pickups; Pickups.push_back(m_Contents.RemoveOneItem(a_SlotNum)); - m_World->SpawnItemPickups(Pickups, DispX, DispY, DispZ); + + const int PickupSpeed = m_World->GetTickRandomNumber(4) + 2; // At least 2, at most 6 + int PickupSpeedX = 0, PickupSpeedY = 0, PickupSpeedZ = 0; + switch (Meta) + { + case E_META_DROPSPENSER_FACING_YP: PickupSpeedY = PickupSpeed; break; + case E_META_DROPSPENSER_FACING_YM: PickupSpeedY = -PickupSpeed; break; + case E_META_DROPSPENSER_FACING_XM: PickupSpeedX = -PickupSpeed; break; + case E_META_DROPSPENSER_FACING_XP: PickupSpeedX = PickupSpeed; break; + case E_META_DROPSPENSER_FACING_ZM: PickupSpeedZ = -PickupSpeed; break; + case E_META_DROPSPENSER_FACING_ZP: PickupSpeedZ = PickupSpeed; break; + } + + double MicroX, MicroY, MicroZ; + MicroX = DispX + 0.5; + MicroY = DispY + 0.4; // Slightly less than half, to accomodate actual texture hole on DropSpenser + MicroZ = DispZ + 0.5; + + + m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ); } |