diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-28 20:50:44 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-28 20:50:44 +0200 |
commit | 3138daa1f8902a9e57d8ff2aa2951a194808b8ae (patch) | |
tree | b6270f3e69cc59420158973662b9de667e3f9e86 /source/DropSpenserEntity.cpp | |
parent | More dropspenser redstone interaction fixes. (diff) | |
download | cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar.gz cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar.bz2 cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar.lz cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar.xz cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.tar.zst cuberite-3138daa1f8902a9e57d8ff2aa2951a194808b8ae.zip |
Diffstat (limited to 'source/DropSpenserEntity.cpp')
-rw-r--r-- | source/DropSpenserEntity.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source/DropSpenserEntity.cpp b/source/DropSpenserEntity.cpp index 85eaa8297..0d07ec27b 100644 --- a/source/DropSpenserEntity.cpp +++ b/source/DropSpenserEntity.cpp @@ -7,6 +7,7 @@ #include "Globals.h"
#include "DropSpenserEntity.h"
#include "Player.h"
+#include "Chunk.h"
@@ -57,13 +58,8 @@ void cDropSpenserEntity::AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & -void cDropSpenserEntity::DropSpense(void)
+void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
{
- int Disp_X = m_PosX;
- int Disp_Y = m_PosY;
- int Disp_Z = m_PosZ;
- NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
-
// Pick one of the occupied slots:
int OccupiedSlots[9];
int SlotsCnt = 0;
@@ -86,16 +82,17 @@ void cDropSpenserEntity::DropSpense(void) int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
// DropSpense the item, using the specialized behavior in the subclasses:
- DropSpenseFromSlot(OccupiedSlots[RandomSlot]);
+ DropSpenseFromSlot(a_Chunk, OccupiedSlots[RandomSlot]);
// Broadcast a smoke and click effects:
- NIBBLETYPE SmokeDir = 0;
+ NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
+ int SmokeDir = 0;
switch (Meta)
{
- case 2: SmokeDir = 1; break;
- case 3: SmokeDir = 7; break;
- case 4: SmokeDir = 3; break;
- case 5: SmokeDir = 5; break;
+ case E_META_DISPENSER_FACING_XM: SmokeDir = 3; break;
+ case E_META_DISPENSER_FACING_XP: SmokeDir = 5; break;
+ case E_META_DISPENSER_FACING_ZM: SmokeDir = 1; break;
+ case E_META_DISPENSER_FACING_ZP: SmokeDir = 7; break;
}
m_World->BroadcastSoundParticleEffect(2000, m_PosX * 8, m_PosY * 8, m_PosZ * 8, SmokeDir);
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
@@ -134,7 +131,7 @@ void cDropSpenserEntity::SetRedstonePower(bool a_IsPowered) -bool cDropSpenserEntity::Tick(float a_Dt)
+bool cDropSpenserEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
if (!m_ShouldDropSpense)
{
@@ -142,7 +139,7 @@ bool cDropSpenserEntity::Tick(float a_Dt) }
m_ShouldDropSpense = false;
- DropSpense();
+ DropSpense(a_Chunk);
return true;
}
@@ -231,12 +228,12 @@ void cDropSpenserEntity::UsedBy(cPlayer * a_Player) -void cDropSpenserEntity::DropFromSlot(int a_SlotNum)
+void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
{
int DispX = m_PosX;
int DispY = m_PosY;
int DispZ = m_PosZ;
- NIBBLETYPE Meta = m_World->GetBlockMeta(m_PosX, m_PosY, m_PosZ);
+ NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
AddDropSpenserDir(DispX, DispY, DispZ, Meta);
cItems Pickups;
|