summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-07-27 01:12:41 +0200
committerGitHub <noreply@github.com>2018-07-27 01:12:41 +0200
commitcdd8e425872b94878babf7823cd12381d2db1a5c (patch)
treefea666b4d4c4e10da6a957a0e403c747dbd74ef9
parentCheckBasicStyle: Check number of empty lines between functions (#4267) (diff)
downloadcuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar.gz
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar.bz2
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar.lz
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar.xz
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.tar.zst
cuberite-cdd8e425872b94878babf7823cd12381d2db1a5c.zip
-rw-r--r--Server/Plugins/APIDump/Classes/World.lua56
-rw-r--r--src/Bindings/ManualBindings_World.cpp319
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp2
-rw-r--r--src/BlockEntities/JukeboxEntity.cpp4
-rw-r--r--src/Blocks/BlockDoor.cpp2
-rw-r--r--src/Blocks/BlockFenceGate.h2
-rw-r--r--src/ClientHandle.cpp2
-rw-r--r--src/Entities/ExpBottleEntity.cpp2
-rw-r--r--src/Entities/SplashPotionEntity.cpp4
-rw-r--r--src/Mobs/Horse.cpp8
-rw-r--r--src/Mobs/Sheep.cpp2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h2
-rw-r--r--src/Simulator/SandSimulator.cpp2
-rw-r--r--src/UI/SlotArea.cpp7
-rw-r--r--src/World.cpp31
-rw-r--r--src/World.h31
16 files changed, 362 insertions, 114 deletions
diff --git a/Server/Plugins/APIDump/Classes/World.lua b/Server/Plugins/APIDump/Classes/World.lua
index 8f1b29012..bb991d9e6 100644
--- a/Server/Plugins/APIDump/Classes/World.lua
+++ b/Server/Plugins/APIDump/Classes/World.lua
@@ -293,6 +293,38 @@ return
IsOptional = true,
},
},
+ Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}. <b>OBSOLETE</b>, use the vector-based overload instead",
+ },
+ BroadcastParticleEffect =
+ {
+ Params =
+ {
+ {
+ Name = "ParticleName",
+ Type = "string",
+ },
+ {
+ Name = "SourcePos",
+ Type = "Vector3f"
+ },
+ {
+ Name = "Offset",
+ Type = "Vector3f",
+ },
+ {
+ Name = "ParticleData",
+ Type = "number",
+ },
+ {
+ Name = "ParticleAmount",
+ Type = "number",
+ },
+ {
+ Name = "ExcludeClient",
+ Type = "cClientHandle",
+ IsOptional = true,
+ },
+ },
Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}",
},
BroadcastSoundEffect =
@@ -389,6 +421,30 @@ return
IsOptional = true,
},
},
+ Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient. <b>OBSOLETE</b>, use the vector overload instead",
+ },
+ BroadcastSoundParticleEffect =
+ {
+ Params =
+ {
+ {
+ Name = "EffectID",
+ Type = "number",
+ },
+ {
+ Name = "SourcePos",
+ Type = "Vector3i"
+ },
+ {
+ Name = "EffectData",
+ Type = "string",
+ },
+ {
+ Name = "ExcludeClient",
+ Type = "cClientHandle",
+ IsOptional = true,
+ },
+ },
Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient",
},
CastThunderbolt =
diff --git a/src/Bindings/ManualBindings_World.cpp b/src/Bindings/ManualBindings_World.cpp
index f5b846dde..9b51ab926 100644
--- a/src/Bindings/ManualBindings_World.cpp
+++ b/src/Bindings/ManualBindings_World.cpp
@@ -13,48 +13,258 @@
#include "LuaChunkStay.h"
+/** Check that a Lua parameter is either a vector or 3 numbers in sequence
+\param L The Lua state
+\param a_VectorName name of the vector class e.g. "Vector3<int>"
+\param a_Index Index to the start of the vector in the parameter list
+\param[out] a_NextIndex Index of the next parameter after the vector
+\retval true if the parameter is a vector or 3 numbers */
+static bool CheckParamVectorOr3Numbers(cLuaState & L, const char * a_VectorName, int a_Index, int & a_NextIndex)
+{
+ if (L.IsParamUserType(a_Index, a_VectorName))
+ {
+ a_NextIndex = a_Index + 1;
+ return L.CheckParamUserType(a_Index, a_VectorName);
+ }
+
+ a_NextIndex = a_Index + 3;
+ return L.CheckParamNumber(a_Index, a_Index + 2);
+}
+
+
+
+
+
+/** Get a vector from the stack, which may be represented in lua as either a `Vector3<T>` or 3 numbers */
+template <typename T>
+static bool GetStackVectorOr3Numbers(cLuaState & L, int a_Index, Vector3<T> & a_Return)
+{
+ Vector3<T> * UserType;
+ if (L.GetStackValue(a_Index, UserType))
+ {
+ a_Return = *UserType;
+ return true;
+ }
+ return L.GetStackValues(a_Index, a_Return.x, a_Return.y, a_Return.z);
+}
+
+
+
+
+
+static int tolua_cWorld_BroadcastBlockAction(lua_State * tolua_S)
+{
+ /* Function signature:
+ void BroadcastBlockAction(number a_BlockX, number a_BlockY, number a_BlockZ, number a_number1, number a_number2, number a_BlockType, cClientHandle a_Exclude)
+ --or--
+ void BroadcastBlockAction(Vector3<int> a_BlockPos, number a_Byte1, number a_Byte2, number a_BlockType, cClientHandle a_Exclude)
+ */
+
+ cLuaState L(tolua_S);
+ int Byte1Index;
+ if (
+ !L.CheckParamSelf("cWorld") ||
+ !CheckParamVectorOr3Numbers(L, "Vector3<int>", 2, Byte1Index) ||
+ !L.CheckParamNumber(Byte1Index, Byte1Index + 2)
+ )
+ {
+ return 0;
+ }
+
+ if (Byte1Index != 3) // Not the vector overload
+ {
+ L.LogStackTrace();
+ LOGWARN("BroadcastBlockAction with 3 position arguments is deprecated, use vector-parametered version instead.");
+ }
+
+ // Read the params:
+ cWorld * Self;
+ Vector3i BlockPos;
+ Byte Byte1, Byte2;
+ BLOCKTYPE BlockType;
+ const cClientHandle * Exclude = nullptr;
+
+ if (
+ !L.GetStackValues(1, Self) ||
+ !GetStackVectorOr3Numbers(L, 2, BlockPos) ||
+ !L.GetStackValues(Byte1Index, Byte1, Byte2, BlockType)
+ )
+ {
+ return 0;
+ }
+
+ // Optional param
+ L.GetStackValue(Byte1Index + 3, Exclude);
+
+ Self->BroadcastBlockAction(BlockPos, Byte1, Byte2, BlockType, Exclude);
+ return 0;
+}
+
+
+
+
+
+static int tolua_cWorld_BroadcastSoundEffect(lua_State * tolua_S)
+{
+ /* Function signature:
+ void BroadcastSoundEffect(string a_SoundName, number a_X, number a_Y, number a_Z, number a_Volume, number a_Pitch, [cClientHandle * a_Exclude])
+ --or--
+ void BroadcastSoundEffect(string a_SoundName, Vector3d, number a_Volume, number a_Pitch, [cClientHandle a_Exclude])
+ */
+ cLuaState L(tolua_S);
+ int VolumeIndex;
+ if (
+ !L.CheckParamSelf("cWorld") ||
+ !L.CheckParamString(2) ||
+ !CheckParamVectorOr3Numbers(L, "Vector3<double>", 3, VolumeIndex) ||
+ !L.CheckParamNumber(VolumeIndex, VolumeIndex + 1)
+ )
+ {
+ return 0;
+ }
+
+ if (VolumeIndex != 4) // Not the vector overload
+ {
+ L.LogStackTrace();
+ LOGWARN("BroadcastSoundEffect with 3 position arguments is deprecated, use vector-parametered version instead.");
+ }
+
+ // Read the params:
+ cWorld * Self;
+ AString SoundName;
+ Vector3d BlockPos;
+ float Volume, Pitch;
+ const cClientHandle * Exclude = nullptr;
+
+ if (
+ !L.GetStackValues(1, Self, SoundName) ||
+ !GetStackVectorOr3Numbers(L, 3, BlockPos) ||
+ !L.GetStackValues(VolumeIndex, Volume, Pitch)
+ )
+ {
+ return 0;
+ }
+
+ // Optional param
+ L.GetStackValue(VolumeIndex + 2, Exclude);
+
+ Self->BroadcastSoundEffect(SoundName, BlockPos, Volume, Pitch, Exclude);
+ return 0;
+}
+
+
+
+
+
+static int tolua_cWorld_BroadcastSoundParticleEffect(lua_State * tolua_S)
+{
+ /* Function signature:
+ World:BroadcastSoundParticleEffect(EffectID a_EffectID, Vector3i a_SrcPos, number a_Data, [cClientHandle a_Exclude])
+ --or--
+ void BroadcastSoundParticleEffect(EffectID a_EffectID, number a_SrcX, number a_SrcY, number a_SrcZ, number a_Data, [cClientHandle a_Exclude])
+ */
+ cLuaState L(tolua_S);
+ int DataIndex;
+ if (
+ !L.CheckParamSelf("cWorld") ||
+ !L.CheckParamNumber(2) ||
+ !CheckParamVectorOr3Numbers(L, "Vector3<int>", 3, DataIndex) ||
+ !L.CheckParamNumber(DataIndex)
+ )
+ {
+ return 0;
+ }
+
+ if (DataIndex != 4) // Not the vector overload
+ {
+ L.LogStackTrace();
+ LOGWARN("BroadcastSoundParticleEffect with 3 position arguments is deprecated, use vector-parametered version instead.");
+ }
+
+ // Read the params:
+ cWorld * World = nullptr;
+ Int32 EffectId;
+ Vector3i SrcPos;
+ int Data;
+ cClientHandle * ExcludeClient = nullptr;
+
+ if (
+ !L.GetStackValues(1, World, EffectId) ||
+ !GetStackVectorOr3Numbers(L, 3, SrcPos) ||
+ !L.GetStackValue(DataIndex, Data)
+ )
+ {
+ return 0;
+ }
+
+ // Optional param
+ L.GetStackValue(DataIndex + 1, ExcludeClient);
+
+ World->BroadcastSoundParticleEffect(static_cast<EffectID>(EffectId), SrcPos, Data, ExcludeClient);
+ return 0;
+}
+
+
static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S)
{
/* Function signature:
- World:BroadcastParticleEffect("Name", PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2]
+ World:BroadcastParticleEffect("Name", PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2])
+ --or--
+ World:BroadcastParticleEffect("Name", SrcPos, Offset, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2])
*/
cLuaState L(tolua_S);
+ int OffsetIndex, ParticleDataIndex;
if (
- !L.CheckParamUserType(1, "cWorld") ||
- !L.CheckParamString (2) ||
- !L.CheckParamNumber (3, 10)
+ !L.CheckParamSelf("cWorld") ||
+ !L.CheckParamString(2) ||
+ !CheckParamVectorOr3Numbers(L, "Vector3<float>", 3, OffsetIndex) ||
+ !CheckParamVectorOr3Numbers(L, "Vector3<float>", OffsetIndex, ParticleDataIndex)
)
{
return 0;
}
+ if ((OffsetIndex != 4) || (ParticleDataIndex != 5)) // Not the vector overload
+ {
+ L.LogStackTrace();
+ LOGWARN("BroadcastParticleEffect with 3 position and 3 offset arguments is deprecated, use vector-parametered version instead.");
+ }
+
// Read the params:
cWorld * World = nullptr;
AString Name;
- float PosX, PosY, PosZ, OffX, OffY, OffZ;
+ Vector3f SrcPos, Offset;
float ParticleData;
int ParticleAmount;
cClientHandle * ExcludeClient = nullptr;
- L.GetStackValues(1, World, Name, PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, ExcludeClient);
- if (World == nullptr)
+
+ if (
+ !L.GetStackValues(1, World, Name) ||
+ !GetStackVectorOr3Numbers(L, 3, SrcPos) ||
+ !GetStackVectorOr3Numbers(L, OffsetIndex, Offset) ||
+ !L.GetStackValues(ParticleDataIndex, ParticleData, ParticleAmount)
+ )
{
- LOGWARNING("World:BroadcastParticleEffect(): invalid world parameter");
- L.LogStackTrace();
return 0;
}
- // Read up to 2 more optional data params:
- std::array<int, 2> data;
- for (int i = 0; (i < 2) && L.IsParamNumber(11 + i); i++)
- {
- L.GetStackValue(11 + i, data[static_cast<size_t>(i)]);
- }
+ // Read up to 3 more optional params:
+ L.GetStackValue(ParticleDataIndex + 2, ExcludeClient);
- World->BroadcastParticleEffect(Name, Vector3f(PosX, PosY, PosZ), Vector3f(OffX, OffY, OffZ), ParticleData, ParticleAmount, ExcludeClient);
+ std::array<int, 2> Data;
+ bool HasData = L.GetStackValues(ParticleDataIndex + 3, Data[0], Data[1]);
+ if (HasData)
+ {
+ World->BroadcastParticleEffect(Name, SrcPos, Offset, ParticleData, ParticleAmount, Data, ExcludeClient);
+ }
+ else
+ {
+ World->BroadcastParticleEffect(Name, SrcPos, Offset, ParticleData, ParticleAmount, ExcludeClient);
+ }
return 0;
}
@@ -668,43 +878,46 @@ void cManualBindings::BindWorld(lua_State * tolua_S)
{
tolua_beginmodule(tolua_S, nullptr);
tolua_beginmodule(tolua_S, "cWorld");
- tolua_function(tolua_S, "BroadcastParticleEffect", tolua_cWorld_BroadcastParticleEffect);
- tolua_function(tolua_S, "ChunkStay", tolua_cWorld_ChunkStay);
- tolua_function(tolua_S, "DoExplosionAt", tolua_cWorld_DoExplosionAt);
- tolua_function(tolua_S, "DoWithBeaconAt", DoWithXYZ<cWorld, cBeaconEntity, &cWorld::DoWithBeaconAt>);
- tolua_function(tolua_S, "DoWithBedAt", DoWithXYZ<cWorld, cBedEntity, &cWorld::DoWithBedAt>);
- tolua_function(tolua_S, "DoWithBlockEntityAt", DoWithXYZ<cWorld, cBlockEntity, &cWorld::DoWithBlockEntityAt>);
- tolua_function(tolua_S, "DoWithBrewingstandAt", DoWithXYZ<cWorld, cBrewingstandEntity, &cWorld::DoWithBrewingstandAt>);
- tolua_function(tolua_S, "DoWithChestAt", DoWithXYZ<cWorld, cChestEntity, &cWorld::DoWithChestAt>);
- tolua_function(tolua_S, "DoWithCommandBlockAt", DoWithXYZ<cWorld, cCommandBlockEntity, &cWorld::DoWithCommandBlockAt>);
- tolua_function(tolua_S, "DoWithDispenserAt", DoWithXYZ<cWorld, cDispenserEntity, &cWorld::DoWithDispenserAt>);
- tolua_function(tolua_S, "DoWithDropSpenserAt", DoWithXYZ<cWorld, cDropSpenserEntity, &cWorld::DoWithDropSpenserAt>);
- tolua_function(tolua_S, "DoWithDropperAt", DoWithXYZ<cWorld, cDropperEntity, &cWorld::DoWithDropperAt>);
- tolua_function(tolua_S, "DoWithEntityByID", DoWithID< cWorld, cEntity, &cWorld::DoWithEntityByID>);
- tolua_function(tolua_S, "DoWithFlowerPotAt", DoWithXYZ<cWorld, cFlowerPotEntity, &cWorld::DoWithFlowerPotAt>);
- tolua_function(tolua_S, "DoWithFurnaceAt", DoWithXYZ<cWorld, cFurnaceEntity, &cWorld::DoWithFurnaceAt>);
- tolua_function(tolua_S, "DoWithMobHeadAt", DoWithXYZ<cWorld, cMobHeadEntity, &cWorld::DoWithMobHeadAt>);
- tolua_function(tolua_S, "DoWithNoteBlockAt", DoWithXYZ<cWorld, cNoteEntity, &cWorld::DoWithNoteBlockAt>);
- tolua_function(tolua_S, "DoWithPlayer", DoWith< cWorld, cPlayer, &cWorld::DoWithPlayer>);
- tolua_function(tolua_S, "DoWithPlayerByUUID", tolua_cWorld_DoWithPlayerByUUID);
- tolua_function(tolua_S, "FindAndDoWithPlayer", DoWith< cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>);
- tolua_function(tolua_S, "ForEachBlockEntityInChunk", ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>);
- tolua_function(tolua_S, "ForEachBrewingstandInChunk", ForEachInChunk<cWorld, cBrewingstandEntity, &cWorld::ForEachBrewingstandInChunk>);
- tolua_function(tolua_S, "ForEachChestInChunk", ForEachInChunk<cWorld, cChestEntity, &cWorld::ForEachChestInChunk>);
- tolua_function(tolua_S, "ForEachEntity", ForEach< cWorld, cEntity, &cWorld::ForEachEntity>);
- tolua_function(tolua_S, "ForEachEntityInBox", ForEachInBox< cWorld, cEntity, &cWorld::ForEachEntityInBox>);
- tolua_function(tolua_S, "ForEachEntityInChunk", ForEachInChunk<cWorld, cEntity, &cWorld::ForEachEntityInChunk>);
- tolua_function(tolua_S, "ForEachFurnaceInChunk", ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>);
- tolua_function(tolua_S, "ForEachLoadedChunk", tolua_cWorld_ForEachLoadedChunk);
- tolua_function(tolua_S, "ForEachPlayer", ForEach< cWorld, cPlayer, &cWorld::ForEachPlayer>);
- tolua_function(tolua_S, "GetBlockInfo", tolua_cWorld_GetBlockInfo);
- tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cWorld_GetBlockTypeMeta);
- tolua_function(tolua_S, "GetSignLines", tolua_cWorld_GetSignLines);
- tolua_function(tolua_S, "PrepareChunk", tolua_cWorld_PrepareChunk);
- tolua_function(tolua_S, "QueueTask", tolua_cWorld_QueueTask);
- tolua_function(tolua_S, "ScheduleTask", tolua_cWorld_ScheduleTask);
- tolua_function(tolua_S, "SetSignLines", tolua_cWorld_SetSignLines);
- tolua_function(tolua_S, "TryGetHeight", tolua_cWorld_TryGetHeight);
+ tolua_function(tolua_S, "BroadcastBlockAction", tolua_cWorld_BroadcastBlockAction);
+ tolua_function(tolua_S, "BroadcastSoundEffect", tolua_cWorld_BroadcastSoundEffect);
+ tolua_function(tolua_S, "BroadcastSoundParticleEffect", tolua_cWorld_BroadcastSoundParticleEffect);
+ tolua_function(tolua_S, "BroadcastParticleEffect", tolua_cWorld_BroadcastParticleEffect);
+ tolua_function(tolua_S, "ChunkStay", tolua_cWorld_ChunkStay);
+ tolua_function(tolua_S, "DoExplosionAt", tolua_cWorld_DoExplosionAt);
+ tolua_function(tolua_S, "DoWithBeaconAt", DoWithXYZ<cWorld, cBeaconEntity, &cWorld::DoWithBeaconAt>);
+ tolua_function(tolua_S, "DoWithBedAt", DoWithXYZ<cWorld, cBedEntity, &cWorld::DoWithBedAt>);
+ tolua_function(tolua_S, "DoWithBlockEntityAt", DoWithXYZ<cWorld, cBlockEntity, &cWorld::DoWithBlockEntityAt>);
+ tolua_function(tolua_S, "DoWithBrewingstandAt", DoWithXYZ<cWorld, cBrewingstandEntity, &cWorld::DoWithBrewingstandAt>);
+ tolua_function(tolua_S, "DoWithChestAt", DoWithXYZ<cWorld, cChestEntity, &cWorld::DoWithChestAt>);
+ tolua_function(tolua_S, "DoWithCommandBlockAt", DoWithXYZ<cWorld, cCommandBlockEntity, &cWorld::DoWithCommandBlockAt>);
+ tolua_function(tolua_S, "DoWithDispenserAt", DoWithXYZ<cWorld, cDispenserEntity, &cWorld::DoWithDispenserAt>);
+ tolua_function(tolua_S, "DoWithDropSpenserAt", DoWithXYZ<cWorld, cDropSpenserEntity, &cWorld::DoWithDropSpenserAt>);
+ tolua_function(tolua_S, "DoWithDropperAt", DoWithXYZ<cWorld, cDropperEntity, &cWorld::DoWithDropperAt>);
+ tolua_function(tolua_S, "DoWithEntityByID", DoWithID< cWorld, cEntity, &cWorld::DoWithEntityByID>);
+ tolua_function(tolua_S, "DoWithFlowerPotAt", DoWithXYZ<cWorld, cFlowerPotEntity, &cWorld::DoWithFlowerPotAt>);
+ tolua_function(tolua_S, "DoWithFurnaceAt", DoWithXYZ<cWorld, cFurnaceEntity, &cWorld::DoWithFurnaceAt>);
+ tolua_function(tolua_S, "DoWithMobHeadAt", DoWithXYZ<cWorld, cMobHeadEntity, &cWorld::DoWithMobHeadAt>);
+ tolua_function(tolua_S, "DoWithNoteBlockAt", DoWithXYZ<cWorld, cNoteEntity, &cWorld::DoWithNoteBlockAt>);
+ tolua_function(tolua_S, "DoWithPlayer", DoWith< cWorld, cPlayer, &cWorld::DoWithPlayer>);
+ tolua_function(tolua_S, "DoWithPlayerByUUID", tolua_cWorld_DoWithPlayerByUUID);
+ tolua_function(tolua_S, "FindAndDoWithPlayer", DoWith< cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>);
+ tolua_function(tolua_S, "ForEachBlockEntityInChunk", ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>);
+ tolua_function(tolua_S, "ForEachBrewingstandInChunk", ForEachInChunk<cWorld, cBrewingstandEntity, &cWorld::ForEachBrewingstandInChunk>);
+ tolua_function(tolua_S, "ForEachChestInChunk", ForEachInChunk<cWorld, cChestEntity, &cWorld::ForEachChestInChunk>);
+ tolua_function(tolua_S, "ForEachEntity", ForEach< cWorld, cEntity, &cWorld::ForEachEntity>);
+ tolua_function(tolua_S, "ForEachEntityInBox", ForEachInBox< cWorld, cEntity, &cWorld::ForEachEntityInBox>);
+ tolua_function(tolua_S, "ForEachEntityInChunk", ForEachInChunk<cWorld, cEntity, &cWorld::ForEachEntityInChunk>);
+ tolua_function(tolua_S, "ForEachFurnaceInChunk", ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>);
+ tolua_function(tolua_S, "ForEachLoadedChunk", tolua_cWorld_ForEachLoadedChunk);
+ tolua_function(tolua_S, "ForEachPlayer", ForEach< cWorld, cPlayer, &cWorld::ForEachPlayer>);
+ tolua_function(tolua_S, "GetBlockInfo", tolua_cWorld_GetBlockInfo);
+ tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cWorld_GetBlockTypeMeta);
+ tolua_function(tolua_S, "GetSignLines", tolua_cWorld_GetSignLines);
+ tolua_function(tolua_S, "PrepareChunk", tolua_cWorld_PrepareChunk);
+ tolua_function(tolua_S, "QueueTask", tolua_cWorld_QueueTask);
+ tolua_function(tolua_S, "ScheduleTask", tolua_cWorld_ScheduleTask);
+ tolua_function(tolua_S, "SetSignLines", tolua_cWorld_SetSignLines);
+ tolua_function(tolua_S, "TryGetHeight", tolua_cWorld_TryGetHeight);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
}
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index 80fba1864..21856abb6 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -96,7 +96,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
case E_META_DROPSPENSER_FACING_ZM: SmokeDir = static_cast<int>(SmokeDirection::SOUTH); break;
case E_META_DROPSPENSER_FACING_ZP: SmokeDir = static_cast<int>(SmokeDirection::NORTH); break;
}
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, m_PosX, m_PosY, m_PosZ, SmokeDir);
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPos(), SmokeDir);
m_World->BroadcastSoundEffect("block.dispenser.dispense", Vector3d(m_PosX, m_PosY, m_PosZ), 1.0f, 1.0f);
}
diff --git a/src/BlockEntities/JukeboxEntity.cpp b/src/BlockEntities/JukeboxEntity.cpp
index 9fbb99c0e..df699b362 100644
--- a/src/BlockEntities/JukeboxEntity.cpp
+++ b/src/BlockEntities/JukeboxEntity.cpp
@@ -76,7 +76,7 @@ bool cJukeboxEntity::PlayRecord(int a_Record)
EjectRecord();
}
m_Record = a_Record;
- m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, m_PosX, m_PosY, m_PosZ, m_Record);
+ m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, GetPos(), m_Record);
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_ON);
return true;
}
@@ -97,7 +97,7 @@ bool cJukeboxEntity::EjectRecord(void)
Drops.push_back(cItem(static_cast<short>(m_Record), 1, 0));
m_Record = 0;
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
- m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, m_PosX, m_PosY, m_PosZ, 0);
+ m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, GetPos(), 0);
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_OFF);
return true;
}
diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp
index a0c112723..fe0db26ec 100644
--- a/src/Blocks/BlockDoor.cpp
+++ b/src/Blocks/BlockDoor.cpp
@@ -64,7 +64,7 @@ bool cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterfac
case E_BLOCK_OAK_DOOR:
{
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
- a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player.GetClientHandle());
+ a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0, a_Player.GetClientHandle());
break;
}
// Prevent iron door from opening on player click
diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h
index 0044cbc99..c8fca21af 100644
--- a/src/Blocks/BlockFenceGate.h
+++ b/src/Blocks/BlockFenceGate.h
@@ -50,7 +50,7 @@ public:
// Standing aside - use last direction
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, OldMetaData);
}
- a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_FENCE_GATE_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player.GetClientHandle());
+ a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_FENCE_GATE_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0, a_Player.GetClientHandle());
return true;
}
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 8e5381e1d..ec861647f 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1361,7 +1361,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
// The ItemHandler is also responsible for spawning the pickups
cChunkInterface ChunkInterface(World->GetChunkMap());
BlockHandler(a_OldBlock)->OnDestroyedByPlayer(ChunkInterface, *World, *m_Player, a_BlockX, a_BlockY, a_BlockZ);
- World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, a_BlockX, a_BlockY, a_BlockZ, a_OldBlock, this);
+ World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, {a_BlockX, a_BlockY, a_BlockZ}, a_OldBlock, this);
// This call would remove the water, placed from the ice block handler
if (!((a_OldBlock == E_BLOCK_ICE) && (ChunkInterface.GetBlock({a_BlockX, a_BlockY, a_BlockZ}) == E_BLOCK_WATER)))
{
diff --git a/src/Entities/ExpBottleEntity.cpp b/src/Entities/ExpBottleEntity.cpp
index a9d250118..8c28458bd 100644
--- a/src/Entities/ExpBottleEntity.cpp
+++ b/src/Entities/ExpBottleEntity.cpp
@@ -49,7 +49,7 @@ void cExpBottleEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
void cExpBottleEntity::Break(Vector3d a_HitPos)
{
// Spawn an experience orb with a reward between 3 and 11.
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, POSX_TOINT, POSY_TOINT, POSZ_TOINT, 0);
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, GetPosition().Floor(), 0);
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), GetRandomProvider().RandInt(3, 11));
Destroy();
}
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index 15be9706e..d5042f072 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -92,9 +92,7 @@ void cSplashPotionEntity::Splash(Vector3d a_HitPos)
m_World->BroadcastSoundParticleEffect(
EffectID::PARTICLE_SPLASH_POTION,
- FloorC(a_HitPos.x),
- FloorC(a_HitPos.y),
- FloorC(a_HitPos.z),
+ a_HitPos.Floor(),
m_PotionColor
);
}
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index af325ae67..9e04bf106 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -77,10 +77,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (Random.RandBool(0.02))
{
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::SOUTH_EAST));
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::SOUTH_WEST));
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::NORTH_EAST));
- m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::NORTH_WEST));
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::SOUTH_EAST));
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::SOUTH_WEST));
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::NORTH_EAST));
+ m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::NORTH_WEST));
m_World->BroadcastSoundEffect("entity.horse.angry", GetPosition(), 1.0f, 1.0f);
m_Attachee->Detach();
diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp
index 70d991329..415379034 100644
--- a/src/Mobs/Sheep.cpp
+++ b/src/Mobs/Sheep.cpp
@@ -117,7 +117,7 @@ void cSheep::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// The sheep ate the grass so we change it to dirt
m_World->SetBlock(PosX, PosY, PosZ, E_BLOCK_DIRT, 0);
- GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_BLOCK_BREAK, PosX, PosY, PosX, E_BLOCK_GRASS);
+ GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_BLOCK_BREAK, {PosX, PosY, PosX}, E_BLOCK_GRASS);
m_IsSheared = false;
m_World->BroadcastEntityMetadata(*this);
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h b/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
index b41f61941..e1a884337 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/DoorHandler.h
@@ -41,7 +41,7 @@ public:
{
cChunkInterface ChunkInterface(a_World.GetChunkMap());
cBlockDoorHandler::SetOpen(ChunkInterface, a_Position.x, a_Position.y, a_Position.z, (a_PoweringData.PowerLevel != 0));
- a_World.BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_Position.x, a_Position.y, a_Position.z, 0);
+ a_World.BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_Position, 0);
}
return {};
diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp
index d10523c61..53dc3f94d 100644
--- a/src/Simulator/SandSimulator.cpp
+++ b/src/Simulator/SandSimulator.cpp
@@ -276,7 +276,7 @@ void cSandSimulator::FinishFalling(
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_FallingBlockType, a_FallingBlockMeta);
if (a_FallingBlockType == E_BLOCK_ANVIL)
{
- a_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_LAND, a_BlockX, a_BlockY, a_BlockZ, 0);
+ a_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_LAND, {a_BlockX, a_BlockY, a_BlockZ}, 0);
}
return;
}
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index d6b870d0e..19c75d196 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1003,6 +1003,7 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
NIBBLETYPE BlockMeta;
a_Player.GetWorld()->GetBlockTypeMeta(PosX, PosY, PosZ, Block, BlockMeta);
+ const Vector3i BlockPos{PosX, PosY, PosZ};
if (!a_Player.IsGameModeCreative() && (Block == E_BLOCK_ANVIL) && GetRandomProvider().RandBool(0.12))
{
NIBBLETYPE Orientation = BlockMeta & 0x3;
@@ -1013,18 +1014,18 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
{
// Anvil will break
a_Player.GetWorld()->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0);
- a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_BREAK, PosX, PosY, PosZ, 0);
+ a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_BREAK, BlockPos, 0);
a_Player.CloseWindow(false);
}
else
{
a_Player.GetWorld()->SetBlockMeta(PosX, PosY, PosZ, static_cast<NIBBLETYPE>(Orientation | (AnvilDamage << 2)));
- a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, PosX, PosY, PosZ, 0);
+ a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, BlockPos, 0);
}
}
else
{
- a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, PosX, PosY, PosZ, 0);
+ a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, BlockPos, 0);
}
}
diff --git a/src/World.cpp b/src/World.cpp
index e7184c96b..0c4618606 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1730,12 +1730,13 @@ void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks)
-bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal)
+bool cWorld::GrowRipePlant(const int a_BlockX, const int a_BlockY, const int a_BlockZ, bool a_IsByBonemeal)
{
auto & random = GetRandomProvider();
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+ const Vector3i BlockPos{a_BlockX, a_BlockY, a_BlockZ};
switch (BlockType)
{
case E_BLOCK_BEETROOTS:
@@ -1754,7 +1755,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(3));
}
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1774,7 +1775,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
}
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1789,7 +1790,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
++GrowState;
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, static_cast<NIBBLETYPE>(GrowState << 2 | TypeMeta));
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1809,7 +1810,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
}
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1844,7 +1845,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
return false;
}
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1864,7 +1865,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
}
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1899,7 +1900,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
return false;
}
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1930,7 +1931,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1970,7 +1971,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
} // switch (random spawn block type)
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, {a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ}, 0);
} // for i - 50 times
return true;
}
@@ -1985,7 +1986,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -1999,7 +2000,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -2013,7 +2014,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
return true;
}
@@ -2040,7 +2041,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
// spawn flower item
- BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
cItems FlowerItem;
FlowerItem.Add(E_BLOCK_BIG_FLOWER, 1, BlockMeta);
SpawnItemPickups(FlowerItem, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5);
@@ -3085,7 +3086,7 @@ bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Op
if (a_Open != IsOpen)
{
SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta ^ 0x4);
- BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_TRAPDOOR_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0);
+ BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_TRAPDOOR_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0);
return true;
}
return false;
diff --git a/src/World.h b/src/World.h
index 595cdb807..1deae2b74 100644
--- a/src/World.h
+++ b/src/World.h
@@ -162,7 +162,7 @@ public:
// Implemented in Broadcaster.cpp
// (Please keep these alpha-sorted)
virtual void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
- virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
+ virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override; ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
@@ -191,8 +191,8 @@ public:
virtual void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastEntityAnimation (const cEntity & a_Entity, Int8 a_Animation, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
virtual void BroadcastLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
- virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override;
- virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override;
+ virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
+ virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
@@ -202,8 +202,8 @@ public:
virtual void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
virtual void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
- virtual void BroadcastSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
- virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude = nullptr) override;
+ virtual void BroadcastSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
+ virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
virtual void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
virtual void BroadcastThunderbolt (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override;
@@ -212,27 +212,6 @@ public:
virtual void BroadcastUseBed (const cEntity & a_Entity, Vector3i a_BlockPos) override;
virtual void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = nullptr) override;
- // Deprecated broadcasts maintained for lua compatibility
-
- // tolua_begin
- void BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
- {
- LOG("BroadcastBlockAction with integer position is deprecated, use vector-parametered version instead.");
- BroadcastBlockAction({ a_BlockX, a_BlockY, a_BlockZ }, a_Byte1, a_Byte2, a_BlockType, a_Exclude);
- }
-
- void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr)
- {
- LOG("BroadcastSoundEffect with double position arguments is deprecated, use vector-parametered version instead.");
- BroadcastSoundEffect(a_SoundName, { a_X, a_Y, a_Z }, a_Volume, a_Pitch, a_Exclude);
- }
-
- void BroadcastSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = nullptr)
- {
- BroadcastSoundParticleEffect(a_EffectID, { a_SrcX, a_SrcY, a_SrcZ }, a_Data, a_Exclude);
- }
- // tolua_end
-
virtual cBroadcastInterface & GetBroadcastManager(void) override
{
return *this;