From 95be80cdb5322720e7c9fbd13ec2692288afd931 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 14 Dec 2013 16:52:22 +0000 Subject: Implemented note block playing and fixed wire Game of Thrones music in Minecraft, here I come! --- src/ChunkMap.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index cb722af3b..f2195741d 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1899,6 +1899,23 @@ bool cChunkMap::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurna +bool cChunkMap::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithNoteBlockAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + bool cChunkMap::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) { -- cgit v1.2.3 From c56af9a214fad89b5d6e119fa830cbdc6c6f5456 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 15 Dec 2013 10:51:46 +0100 Subject: This adds the cWorld::BroadcastEntityEffect and cWorld::BroadcastRemoveEntityEffect functions. --- src/ChunkMap.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index f2195741d..53b595545 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -445,6 +445,22 @@ void cChunkMap::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHa +void cChunkMap::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityEffect(a_Entity, a_EffectID, a_Amplifier, a_Duration); +} + + + + + void cChunkMap::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSLayers); @@ -589,6 +605,23 @@ void cChunkMap::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animat +void cChunkMap::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastRemoveEntityEffect(a_Entity, a_EffectID, a_Exclude); +} + + + + + void cChunkMap::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSLayers); -- cgit v1.2.3