From 3f9e876d70851ed0333a3fdc57d883f040e92d8b Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 21 Oct 2012 07:46:28 +0000 Subject: Added jukeboxes (patch contributed by Luksor) git-svn-id: http://mc-server.googlecode.com/svn/trunk@994 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Chunk.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'source/Chunk.cpp') diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 7f1c94a07..d10aa6dac 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -16,6 +16,7 @@ #include "FurnaceEntity.h" #include "SignEntity.h" #include "NoteEntity.h" +#include "JukeboxEntity.h" #include "Torch.h" #include "Ladder.h" #include "Pickup.h" @@ -809,6 +810,15 @@ void cChunk::CreateBlockEntities(void) } break; } + + case E_BLOCK_JUKEBOX: + { + if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width)) + { + m_BlockEntities.push_back(new cJukeboxEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World) ); + } + break; + } } // switch (BlockType) } // for y } // for z @@ -934,6 +944,11 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType AddBlockEntity(new cNoteEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World)); break; } + case E_BLOCK_JUKEBOX: + { + AddBlockEntity(new cJukeboxEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World)); + break; + } } // switch (a_BlockType) } @@ -1757,6 +1772,22 @@ void cChunk::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a +void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data); + } // for itr - LoadedByClient[] +} + + + + + void cChunk::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude) { for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) -- cgit v1.2.3