From 0905369fc721fe0057e9e140777dc93f938646c6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 10 Dec 2013 00:29:59 +0000 Subject: Fixed Floody lava to stone fizzle --- .../Plugins/APIDump/Hooks/OnEntityAnimation.lua | 28 ++++++++++++++++++++++ .../Plugins/APIDump/Hooks/OnPlayerAnimation.lua | 28 ---------------------- src/Simulator/FloodyFluidSimulator.cpp | 18 ++++++++++++-- 3 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 MCServer/Plugins/APIDump/Hooks/OnEntityAnimation.lua delete mode 100644 MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityAnimation.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityAnimation.lua new file mode 100644 index 000000000..baf99834e --- /dev/null +++ b/MCServer/Plugins/APIDump/Hooks/OnEntityAnimation.lua @@ -0,0 +1,28 @@ +return +{ + HOOK_PLAYER_ANIMATION = + { + CalledWhen = "A client has sent an Animation packet (0x12)", + DefaultFnName = "OnPlayerAnimation", -- also used as pagename + Desc = [[ + This hook is called when the server receives an Animation packet (0x12) from the client.

+

+ For the list of animations that are sent by the client, see the + Protocol wiki. + ]], + Params = + { + { Name = "Player", Type = "{{cPlayer}}", Notes = "The player from whom the packet was received" }, + { Name = "Animation", Type = "number", Notes = "The kind of animation" }, + }, + Returns = [[ + If the function returns false or no value, the next plugin's callback is called. Afterwards, the + server broadcasts the animation packet to all nearby clients. If the function returns true, no other + callback is called for this event and the packet is not broadcasted. + ]], + }, -- HOOK_PLAYER_ANIMATION +} + + + + diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua deleted file mode 100644 index baf99834e..000000000 --- a/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua +++ /dev/null @@ -1,28 +0,0 @@ -return -{ - HOOK_PLAYER_ANIMATION = - { - CalledWhen = "A client has sent an Animation packet (0x12)", - DefaultFnName = "OnPlayerAnimation", -- also used as pagename - Desc = [[ - This hook is called when the server receives an Animation packet (0x12) from the client.

-

- For the list of animations that are sent by the client, see the - Protocol wiki. - ]], - Params = - { - { Name = "Player", Type = "{{cPlayer}}", Notes = "The player from whom the packet was received" }, - { Name = "Animation", Type = "number", Notes = "The kind of animation" }, - }, - Returns = [[ - If the function returns false or no value, the next plugin's callback is called. Afterwards, the - server broadcasts the animation packet to all nearby clients. If the function returns true, no other - callback is called for this event and the packet is not broadcasted. - ]], - }, -- HOOK_PLAYER_ANIMATION -} - - - - diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index d204a1f8b..58e5d614b 100644 --- a/src/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp @@ -224,7 +224,14 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i ItemTypeToString(NewBlock).c_str() ); a_NearChunk->UnboundedRelSetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0); - m_World.BroadcastSoundEffect("random.fizz", a_RelX * 8, a_RelY * 8, a_RelZ * 8, 0.5f, 1.5f); + + int BaseX = a_NearChunk->GetPosX() * cChunkDef::Width; + int BaseZ = a_NearChunk->GetPosZ() * cChunkDef::Width; + + BaseX += a_RelX; + BaseZ += a_RelZ; + + a_NearChunk->BroadcastSoundEffect("random.fizz", BaseX * 8, a_RelY * 8, BaseZ * 8, 0.5f, 1.5f); return; } } @@ -238,7 +245,14 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i a_RelX, a_RelY, a_RelZ, ItemTypeToString(NewBlock).c_str() ); a_NearChunk->UnboundedRelSetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0); - m_World.BroadcastSoundEffect("random.fizz", a_RelX * 8, a_RelY * 8, a_RelZ * 8, 0.5f, 1.5f); + + int BaseX = a_NearChunk->GetPosX() * cChunkDef::Width; + int BaseZ = a_NearChunk->GetPosZ() * cChunkDef::Width; + + BaseX += a_RelX; + BaseZ += a_RelZ; + + a_NearChunk->BroadcastSoundEffect("random.fizz", BaseX * 8, a_RelY * 8, BaseZ * 8, 0.5f, 1.5f); return; } } -- cgit v1.2.3