summaryrefslogtreecommitdiffstats
path: root/source/BlockEntities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-11-02 17:05:16 +0100
committerMattes D <github@xoft.cz>2013-11-02 17:05:16 +0100
commitc5b6d68517f8a93d52e684e00cf053de6a31ab99 (patch)
tree65a8c524577e76cf353f7478ab1f869bfe4bd2db /source/BlockEntities
parentProtocol 1.7: Implemented the first batch of sent packets. (diff)
parentFixed bow damage in creative (diff)
downloadcuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar.gz
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar.bz2
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar.lz
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar.xz
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.tar.zst
cuberite-c5b6d68517f8a93d52e684e00cf053de6a31ab99.zip
Diffstat (limited to 'source/BlockEntities')
-rw-r--r--source/BlockEntities/DropSpenserEntity.cpp23
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);
}