From 127d021cdef15219bd1fc96efadc778062fe9099 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:15:53 +0000 Subject: [PATCH 01/29] Regenerated VS2013 files --- VC2013/CryptoPP.vcxproj | 130 ++++++++++++++++++++++++++++++++ VC2013/CryptoPP.vcxproj.filters | 6 +- VC2013/JsonCpp.vcxproj | 29 +++++++ VC2013/Lua.vcxproj | 56 ++++++++++++-- VC2013/Lua.vcxproj.filters | 3 - VC2013/MCServer.sln | 15 ++++ VC2013/MCServer.vcxproj | 78 ++++++++++++++++++- VC2013/MCServer.vcxproj.filters | 52 ++++++------- VC2013/ToLua.vcxproj | 29 +++++++ VC2013/expat.vcxproj | 28 +++++++ VC2013/zlib.vcxproj | 29 +++++++ 11 files changed, 413 insertions(+), 42 deletions(-) diff --git a/VC2013/CryptoPP.vcxproj b/VC2013/CryptoPP.vcxproj index 7355ab64b..7ad8edaf6 100644 --- a/VC2013/CryptoPP.vcxproj +++ b/VC2013/CryptoPP.vcxproj @@ -1,6 +1,14 @@  + + Debug_LuaStatic + Win32 + + + Debug_LuaStatic + x64 + Debug Win32 @@ -48,6 +56,11 @@ Application v120 + + StaticLibrary + v120 + false + StaticLibrary v120 @@ -70,6 +83,10 @@ false true + + Application + v120 + StaticLibrary v120 @@ -90,6 +107,10 @@ + + + + @@ -106,6 +127,9 @@ + + + @@ -126,6 +150,10 @@ $(SolutionDir)$(Configuration)\CryptoPP\ $(Configuration)\CryptoPP\ + + $(SolutionDir)$(Configuration)\CryptoPP\ + $(Configuration)\CryptoPP\ + $(Platform)\Output\$(Configuration)\ $(Platform)\$(ProjectName)\$(Configuration)\ @@ -187,6 +215,27 @@ true + + + Disabled + true + _DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + MultiThreadedDebug + StreamingSIMDExtensions + Use + pch.h + $(OutDir)vc80.pdb + Level3 + true + EditAndContinue + + + 0x0409 + + + true + + X64 @@ -292,24 +341,28 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -317,24 +370,28 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -342,6 +399,7 @@ Disabled MaxSpeed + Disabled Disabled Disabled @@ -350,18 +408,21 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -370,12 +431,14 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -386,6 +449,9 @@ MaxSpeed + Disabled + + Disabled @@ -400,6 +466,7 @@ Disabled MaxSpeed + Disabled Disabled Disabled @@ -407,6 +474,7 @@ Disabled MaxSpeed + Disabled Disabled Disabled @@ -415,6 +483,8 @@ Disabled true MaxSpeed + true + Disabled true Disabled true @@ -425,12 +495,14 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -440,6 +512,8 @@ Disabled true MaxSpeed + true + Disabled true Disabled true @@ -450,24 +524,28 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -475,48 +553,56 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -529,6 +615,9 @@ MaxSpeed + Disabled + + Disabled @@ -543,72 +632,84 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -617,6 +718,8 @@ Create MaxSpeed Create + Disabled + Create Disabled Create Disabled @@ -627,12 +730,14 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -640,66 +745,77 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -707,72 +823,84 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled @@ -780,12 +908,14 @@ Disabled MaxSpeed + Disabled Disabled Disabled Disabled MaxSpeed + Disabled Disabled Disabled diff --git a/VC2013/CryptoPP.vcxproj.filters b/VC2013/CryptoPP.vcxproj.filters index ba7db9584..bc8e51b81 100644 --- a/VC2013/CryptoPP.vcxproj.filters +++ b/VC2013/CryptoPP.vcxproj.filters @@ -2,15 +2,15 @@ - {a4186d1f-f2a9-4b49-b13b-a710ef40a767} + {9cc4f7b9-4c1a-4f43-ba70-d1780e59b9af} .cpp - {56d100a3-fe61-4f9d-b7c1-b750a9faf1b1} + {4570686f-18a1-4d38-a53b-062a4c223d4d} .;.h - {fd15b788-329a-459d-b675-9af86fbaa35a} + {6c599481-412e-461e-b3b3-949c4f43474a} diff --git a/VC2013/JsonCpp.vcxproj b/VC2013/JsonCpp.vcxproj index f1dd1c7b5..c609a3450 100644 --- a/VC2013/JsonCpp.vcxproj +++ b/VC2013/JsonCpp.vcxproj @@ -5,6 +5,10 @@ Debug profiled Win32 + + Debug_LuaStatic + Win32 + Debug Win32 @@ -24,6 +28,11 @@ Win32Proj + + StaticLibrary + v120 + Unicode + StaticLibrary v120 @@ -49,6 +58,9 @@ + + + @@ -81,6 +93,10 @@ $(SolutionDir)$(Configuration)\JsonCpp\ $(Configuration)\JsonCpp\ + + $(SolutionDir)$(Configuration)\JsonCpp\ + $(Configuration)\JsonCpp\ + Disabled @@ -133,6 +149,19 @@ EditAndContinue + + + Disabled + ../jsoncpp-src-0.5.0/include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + diff --git a/VC2013/Lua.vcxproj b/VC2013/Lua.vcxproj index 2488aa6aa..8b330a666 100644 --- a/VC2013/Lua.vcxproj +++ b/VC2013/Lua.vcxproj @@ -5,6 +5,10 @@ Debug profiled Win32 + + Debug_LuaStatic + Win32 + Debug Win32 @@ -24,31 +28,39 @@ Win32Proj - + StaticLibrary v120 Unicode + + DynamicLibrary + v120 + Unicode + - StaticLibrary + DynamicLibrary v120 Unicode true - StaticLibrary + DynamicLibrary v120 Unicode true - StaticLibrary + DynamicLibrary v120 Unicode + + + @@ -81,10 +93,14 @@ $(SolutionDir)$(Configuration)\Lua\ $(Configuration)\Lua\ + + $(SolutionDir)$(Configuration)\Lua\ + $(Configuration)\Lua\ + Disabled - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -92,32 +108,57 @@ Level3 EditAndContinue + + $(ProjectDir)\..\MCServer\lua5.1.dll + true + MaxSpeed true - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase + + $(ProjectDir)\..\MCServer\lua5.1.dll + MaxSpeed true - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase + + $(ProjectDir)\..\MCServer\lua5.1.dll + + + Disabled + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + + $(ProjectDir)\..\MCServer\lua5.1.dll + + + Disabled WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) @@ -156,7 +197,6 @@ - diff --git a/VC2013/Lua.vcxproj.filters b/VC2013/Lua.vcxproj.filters index 21cc86850..6d96411ec 100644 --- a/VC2013/Lua.vcxproj.filters +++ b/VC2013/Lua.vcxproj.filters @@ -85,9 +85,6 @@ Source Files - - Source Files - Source Files diff --git a/VC2013/MCServer.sln b/VC2013/MCServer.sln index 9dcfc802e..02eef049b 100644 --- a/VC2013/MCServer.sln +++ b/VC2013/MCServer.sln @@ -19,6 +19,7 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug profiled|Win32 = Debug profiled|Win32 + Debug_LuaStatic|Win32 = Debug_LuaStatic|Win32 Debug|Win32 = Debug|Win32 Release profiled|Win32 = Release profiled|Win32 Release|Win32 = Release|Win32 @@ -26,6 +27,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32 {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug profiled|Win32.Build.0 = Debug profiled|Win32 + {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug|Win32.ActiveCfg = Debug|Win32 {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug|Win32.Build.0 = Debug|Win32 {32012054-0C96-4C43-AB27-174FF8E72D66}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 @@ -34,6 +37,8 @@ Global {32012054-0C96-4C43-AB27-174FF8E72D66}.Release|Win32.Build.0 = Release|Win32 {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32 {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug profiled|Win32.Build.0 = Debug profiled|Win32 + {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug|Win32.ActiveCfg = Debug|Win32 {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug|Win32.Build.0 = Debug|Win32 {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 @@ -42,6 +47,8 @@ Global {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Release|Win32.Build.0 = Release|Win32 {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32 {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug profiled|Win32.Build.0 = Debug profiled|Win32 + {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug|Win32.ActiveCfg = Debug|Win32 {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug|Win32.Build.0 = Debug|Win32 {5AAA90B9-946D-4034-83F3-676B06A6E326}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 @@ -50,6 +57,8 @@ Global {5AAA90B9-946D-4034-83F3-676B06A6E326}.Release|Win32.Build.0 = Release|Win32 {082E8185-7B3A-4945-8C82-9132341A329D}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32 {082E8185-7B3A-4945-8C82-9132341A329D}.Debug profiled|Win32.Build.0 = Debug profiled|Win32 + {082E8185-7B3A-4945-8C82-9132341A329D}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {082E8185-7B3A-4945-8C82-9132341A329D}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {082E8185-7B3A-4945-8C82-9132341A329D}.Debug|Win32.ActiveCfg = Debug|Win32 {082E8185-7B3A-4945-8C82-9132341A329D}.Debug|Win32.Build.0 = Debug|Win32 {082E8185-7B3A-4945-8C82-9132341A329D}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 @@ -58,6 +67,8 @@ Global {082E8185-7B3A-4945-8C82-9132341A329D}.Release|Win32.Build.0 = Release|Win32 {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32 {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug profiled|Win32.Build.0 = Debug profiled|Win32 + {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug|Win32.ActiveCfg = Debug|Win32 {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug|Win32.Build.0 = Debug|Win32 {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 @@ -66,6 +77,8 @@ Global {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.Build.0 = Release|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.ActiveCfg = Debug|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.Build.0 = Debug|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release profiled|Win32.ActiveCfg = Release|Win32 @@ -74,6 +87,8 @@ Global {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.Build.0 = Release|Win32 {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug profiled|Win32.ActiveCfg = Debug|Win32 {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug profiled|Win32.Build.0 = Debug|Win32 + {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32 + {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32 {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug|Win32.ActiveCfg = Debug|Win32 {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug|Win32.Build.0 = Debug|Win32 {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Release profiled|Win32.ActiveCfg = Release|Win32 diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index 0b0c13d81..9c640f6dd 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -1,10 +1,14 @@ - + Debug profiled Win32 + + Debug_LuaStatic + Win32 + Debug Win32 @@ -24,6 +28,11 @@ Win32Proj + + Application + v120 + MultiByte + Application v120 @@ -47,6 +56,9 @@ + + + @@ -81,6 +93,11 @@ $(Configuration)\ true + + $(Configuration)\ + $(Configuration)\ + true + /MP %(AdditionalOptions) @@ -178,6 +195,28 @@ MachineX86 + + + /MP %(AdditionalOptions) + Disabled + ../lib/jsoncpp/include;../lib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebug + Use + Globals.h + Level3 + ProgramDatabase + + + ws2_32.lib;Psapi.lib;%(AdditionalDependencies) + $(ProjectDir)\..\MCServer\$(ProjectName)_debug_luastatic.exe + true + Console + MachineX86 + + @@ -185,7 +224,6 @@ - @@ -320,6 +358,7 @@ true + true true true true @@ -415,6 +454,7 @@ + @@ -481,12 +521,14 @@ true + true true true true true + true true true true @@ -497,6 +539,11 @@ cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs) Bindings.cpp;%(Outputs) + true + GenerateBindings.cmd + + cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs) + Bindings.cpp;%(Outputs) true GenerateBindings.cmd @@ -585,6 +632,7 @@ Create + Create Create Create Create @@ -598,6 +646,9 @@ Level3 + + + Level3 Level3 @@ -628,6 +679,13 @@ Default + MaxSpeed + true + Speed + true + Default + + MaxSpeed true Speed @@ -646,6 +704,9 @@ Level3 + + + Level3 Level3 @@ -732,12 +793,14 @@ true + true true true true true + true true true true @@ -745,6 +808,8 @@ + + @@ -764,6 +829,9 @@ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) @@ -810,6 +878,8 @@ + + @@ -820,6 +890,8 @@ + + @@ -830,6 +902,8 @@ + + diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters index f84fdf1a5..be0a37dc1 100644 --- a/VC2013/MCServer.vcxproj.filters +++ b/VC2013/MCServer.vcxproj.filters @@ -10,73 +10,73 @@ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - {d3e4f61e-bc56-4454-8036-8a546cf8fb0b} + {52f3d533-108a-4cd8-8be2-19c799667e26} - {520ca259-2c9e-482f-9690-1768c4d29939} + {727392f6-6dc8-4c0f-8380-2affc45d20d4} - {21ab8bcf-53a0-4eec-b597-db45d6cd8635} + {169eedf6-1244-49d1-9a74-79002dee80a7} - {73debd14-b218-4313-9389-1a0e62dae8b7} + {78798af4-7e8b-4f86-8175-c34995b71a7f} - {2cbd2a0f-6204-4ed6-a825-f9e81fe86d98} + {a9d6163b-75c5-47ef-8ebd-192c0053d987} - {b80f90c1-713e-4c86-ab50-78d7f5aa6c82} + {4e664e9b-8741-4701-9f32-60dcc29f6463} - {d29f7a59-d5d7-4b06-bd73-563007f3a15a} + {5496fc08-0db0-4de0-adff-760fa67a8a78} - {c8e6ce30-56d9-42b7-8a5d-0af0f1b8c5c6} + {0162bb1a-bed1-4e87-9ab7-c3da55911060} - {0aff46f9-2a5c-4e23-8227-6c7a318efd98} + {82c6a5ba-3211-4c01-a643-9cdf2983630f} - {86cc1a62-5a4a-4b55-9919-c1944a2f17bc} + {fc99053a-c609-4646-ad85-9cbaccbcf1c5} - {6ae1cee3-6e6a-464e-806c-5dd353137bdd} + {83b41e57-43fe-4bfc-8ca5-d0d460834d59} - {2e9149ad-0762-42b6-9041-e23f83934380} + {d53d761d-7d28-41dd-9623-6b489fbba65a} - {43922b25-52e6-41e0-a534-0220c585fb64} + {d3534b5b-4684-4857-befa-b78b9198eed8} - {28ba3c86-6782-4b9c-8ad1-4815a9990f56} + {96831397-1e56-4d07-9a3f-d97b9caa3f64} - {17718a17-83c9-4e37-9be9-a7974fae412c} + {6c6cceb3-545c-4698-a5c9-c01497e80022} - {5f9cb95f-1a51-4962-ad30-09c5e43dd9ae} + {7491cc4f-d735-4546-8aad-24d11a7396b0} - {ee51cab4-2a1d-4fb2-9f33-ff5f42ee5c2c} + {201c626a-b869-407a-9c2a-e06cf8c8e127} - {a4c0514f-61e0-4a3e-90af-aa92850a6cad} + {cd93064b-e465-4562-a09b-de2363d0fab4} - {cdc2d187-0019-4de2-8f76-d224bbda63ee} + {8947d9a2-b1dc-4c3e-8c27-05ca5260843d} - {9960d29d-8cdd-48a7-8f72-6abb7882e0f8} + {26e14e8c-ffde-4f83-b3a0-e0001d590e7a} - {39ac0d09-047a-43f4-8472-d99ba62834e5} + {44ae2ab1-5552-4e84-b8b5-f28a59af0c4f} - {7b6aed62-c48a-4c44-83ca-e459a16a6232} + {ac8a4c54-36f2-4505-a0dc-66f2817ccfa7} - {4feccf69-36aa-4881-a844-7a6f8a9e8291} + {3e58b3c7-097f-4688-a619-2771353180fe} @@ -759,6 +759,9 @@ Source Files\Blocks + + Source Files\Blocks + Source Files\Blocks @@ -942,9 +945,6 @@ Source Files\HTTPServer - - Source Files\Blocks - diff --git a/VC2013/ToLua.vcxproj b/VC2013/ToLua.vcxproj index c798af657..4895f0a61 100644 --- a/VC2013/ToLua.vcxproj +++ b/VC2013/ToLua.vcxproj @@ -5,6 +5,10 @@ Debug profiled Win32 + + Debug_LuaStatic + Win32 + Debug Win32 @@ -24,6 +28,11 @@ Win32Proj + + StaticLibrary + v120 + Unicode + StaticLibrary v120 @@ -49,6 +58,9 @@ + + + @@ -81,6 +93,10 @@ $(SolutionDir)$(Configuration)\ToLua\ $(Configuration)\ToLua\ + + $(SolutionDir)$(Configuration)\ToLua\ + $(Configuration)\ToLua\ + Disabled @@ -133,6 +149,19 @@ EditAndContinue + + + Disabled + ../lib/tolua++/include;../lib/lua/src;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + diff --git a/VC2013/expat.vcxproj b/VC2013/expat.vcxproj index 388bf6158..00f9ea3d2 100644 --- a/VC2013/expat.vcxproj +++ b/VC2013/expat.vcxproj @@ -1,6 +1,10 @@  + + Debug_LuaStatic + Win32 + Debug Win32 @@ -16,6 +20,11 @@ Win32Proj + + StaticLibrary + v120 + MultiByte + StaticLibrary v120 @@ -30,6 +39,9 @@ + + + @@ -48,6 +60,10 @@ $(SolutionDir)$(Configuration)\ $(Configuration)/expat\ + + $(SolutionDir)$(Configuration)\expat\ + $(Configuration)\expat\ + Disabled @@ -72,6 +88,18 @@ ProgramDatabase + + + Disabled + WIN32;_DEBUG;_LIB;COMPILED_FROM_DSP;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + diff --git a/VC2013/zlib.vcxproj b/VC2013/zlib.vcxproj index 3aeacf329..7bb2b743b 100644 --- a/VC2013/zlib.vcxproj +++ b/VC2013/zlib.vcxproj @@ -5,6 +5,10 @@ Debug profiled Win32 + + Debug_LuaStatic + Win32 + Debug Win32 @@ -24,6 +28,11 @@ Win32Proj + + StaticLibrary + v120 + Unicode + StaticLibrary v120 @@ -49,6 +58,9 @@ + + + @@ -81,6 +93,10 @@ $(SolutionDir)$(Configuration)\zlib\ $(Configuration)\zlib\ + + $(SolutionDir)$(Configuration)\zlib\ + $(Configuration)\zlib\ + Disabled @@ -133,6 +149,19 @@ 4996;%(DisableSpecificWarnings) + + + Disabled + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + 4996;%(DisableSpecificWarnings) + + From ee4d57a0761c6d82a1b449810cc5321d77b1cf9b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:17:57 +0000 Subject: [PATCH 02/29] Fixed pickups spawning for BlockEntities --- src/BlockEntities/BlockEntityWithItems.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h index 0846ae17e..f35412e03 100644 --- a/src/BlockEntities/BlockEntityWithItems.h +++ b/src/BlockEntities/BlockEntityWithItems.h @@ -48,7 +48,7 @@ public: cItems Pickups; m_Contents.CopyToItems(Pickups); m_Contents.Clear(); - m_World->SpawnItemPickups(Pickups, m_PosX, m_PosY, m_PosZ); + m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); // Spawn in centre of block } // tolua_begin From 57b8b3851179dacb1c07aba5808d61ba51d9b435 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:22:25 +0000 Subject: [PATCH 03/29] Updated comments for slabs --- src/ClientHandle.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 95d8f23e5..bcd0f7192 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -685,12 +685,10 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc int pX = a_BlockX; int pY = a_BlockY; int pZ = a_BlockZ; - AddFaceDirection(pX, pY, pZ, a_BlockFace); + AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false) Handler = cBlockHandler::GetBlockHandler(World->GetBlock(pX, pY, pZ)); - - // 2013_01_05 _X: This looks weird - // Why do we ask the block "behind" the one being clicked if it is clicked through? Shouldn't we ask the primary block instead? + if (Handler->IsClickedThrough()) { Handler->OnDigging(World, m_Player, pX, pY, pZ); @@ -886,7 +884,10 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c ) ) { - // Coordinates at CLICKED block, don't move them anywhere + // Coordinates at clicked block, which was an eligible slab, and either top or bottom faces were clicked + // If clicked top face and slab occupies the top voxel, we want a slab to be placed above it (therefore increment Y) + // Else if clicked bottom face and slab occupies the bottom voxel, decrement Y for the same reason + // Don't touch coordinates if anything else because a dblslab opportunity is present if((ClickedBlockMeta & 0x08) && (a_BlockFace == BLOCK_FACE_TOP)) { ++a_BlockY; From 0376b847d76d0b47cd86ac862f3b0554bcfbe6aa Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:23:27 +0000 Subject: [PATCH 04/29] Removed exporting of a torch function --- src/Blocks/BlockTorch.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 72a313126..2e7c5b814 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -55,8 +55,8 @@ public: } - static NIBBLETYPE DirectionToMetaData(char a_Direction) // tolua_export - { // tolua_export + static NIBBLETYPE DirectionToMetaData(char a_Direction) + { switch (a_Direction) { case BLOCK_FACE_BOTTOM: ASSERT(!"Shouldn't be getting this face"); return 0; @@ -72,7 +72,7 @@ public: } }; return 0x0; - } // tolua_export + } static char MetaDataToDirection(NIBBLETYPE a_MetaData) // tolua_export From 73dd2e9bed39c5f902a82568805f4328a0a79526 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:24:45 +0000 Subject: [PATCH 05/29] Removed another export and inline'd stuff --- src/Blocks/BlockTorch.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 2e7c5b814..342d88b6c 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -55,7 +55,7 @@ public: } - static NIBBLETYPE DirectionToMetaData(char a_Direction) + inline static NIBBLETYPE DirectionToMetaData(char a_Direction) { switch (a_Direction) { @@ -75,11 +75,11 @@ public: } - static char MetaDataToDirection(NIBBLETYPE a_MetaData) // tolua_export - { // tolua_export + inline static char MetaDataToDirection(NIBBLETYPE a_MetaData) + { switch (a_MetaData) { - case 0: return BLOCK_FACE_TOP; // by default, the torches stand on the ground + case 0: return BLOCK_FACE_TOP; // By default, the torches stand on the ground case E_META_TORCH_FLOOR: return BLOCK_FACE_TOP; case E_META_TORCH_EAST: return BLOCK_FACE_EAST; case E_META_TORCH_WEST: return BLOCK_FACE_WEST; @@ -92,7 +92,7 @@ public: } } return 0; - } // tolua_export + } static bool IsAttachedTo(const Vector3i & a_TorchPos, char a_TorchMeta, const Vector3i & a_BlockPos) From 77a7bfb3e546446412993fc0c30ba55298c76661 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:35:10 +0000 Subject: [PATCH 06/29] Cleaned up torch code and added comments --- src/Blocks/BlockTorch.h | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 342d88b6c..9e543dfd7 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -38,7 +38,8 @@ public: else { // Not top or bottom faces, try to preserve whatever face was clicked - if (!TorchCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace)) + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true); + if (!CanBePlacedOn(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ), a_BlockFace)) { // Torch couldn't be placed on whatever face was clicked, last ditch resort - find another face a_BlockFace = FindSuitableFace(a_World, a_BlockX, a_BlockY, a_BlockZ); @@ -95,31 +96,11 @@ public: } - static bool IsAttachedTo(const Vector3i & a_TorchPos, char a_TorchMeta, const Vector3i & a_BlockPos) - { - switch (a_TorchMeta) - { - case 0x0: - case E_META_TORCH_FLOOR: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 1, 0))); - case E_META_TORCH_EAST: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 0, -1))); - case E_META_TORCH_WEST: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 0, 1))); - case E_META_TORCH_NORTH: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(-1, 0, 0))); - case E_META_TORCH_SOUTH: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(1, 0, 0))); - default: - { - ASSERT(!"Unhandled torch meta!"); - break; - } - } - return false; - } - - static bool CanBePlacedOn(BLOCKTYPE a_BlockType, char a_BlockFace) { if ( !g_BlockIsTorchPlaceable[a_BlockType] ) { - return (a_BlockFace == BLOCK_FACE_TOP); // Allow placement only when torch upright + return (a_BlockFace == BLOCK_FACE_TOP); // Allow placement only when torch upright (for glass, etc.); exceptions won't even be sent by client, no need to handle } else { @@ -128,22 +109,15 @@ public: } - static bool TorchCanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace) - { - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true); - return CanBePlacedOn(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ), a_BlockFace); - } - - /// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure static char FindSuitableFace(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) { - for (int i = 0; i <= 5; i++) + for (int i = BLOCK_FACE_YM; i <= BLOCK_FACE_XP; i++) // Loop through all directions { AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true); BLOCKTYPE BlockInQuestion = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - if ( + if ( // If on a block that can only hold a torch if torch is standing on it, return that face ((BlockInQuestion == E_BLOCK_GLASS) || (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || @@ -155,10 +129,12 @@ public: } else if ((g_BlockIsTorchPlaceable[BlockInQuestion]) && (i != BLOCK_FACE_BOTTOM)) { + // Otherwise, if block in that direction is torch placeable and we haven't gotten to it via the bottom face, return that face return i; } else { + // Reset coords in preparation for next iteration AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, false); } } From 44d5fd1e879dbdafc72097edfb1ad35367503e95 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 19:59:14 +0000 Subject: [PATCH 07/29] Tools make a sound when breaking, fixes #266 --- src/Entities/Player.cpp | 5 ++++- src/Entities/ProjectileEntity.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 910613e98..bfacc3422 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1575,7 +1575,10 @@ void cPlayer::UseEquippedItem(void) return; } - GetInventory().DamageEquippedItem(); + if (GetInventory().DamageEquippedItem()) + { + m_World->BroadcastSoundEffect("random.break", (int)GetPosX() * 8, (int)GetPosY() * 8, (int)GetPosZ() * 8, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); + } } diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index fb25aea35..1d49c2445 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -466,7 +466,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace) m_HitBlockPos = Vector3i(a_X, a_Y, a_Z); // Broadcast arrow hit sound - m_World->BroadcastSoundEffect("random.bowhit", (int)GetPosX() * 8, (int)GetPosY() * 8, (int)GetPosZ() * 8, 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("random.bowhit", (int)GetPosX() * 8, (int)GetPosY() * 8, (int)GetPosZ() * 8, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); } From 6c7de446ae2a691296a25dc74022e09761ef8197 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:00:49 +0000 Subject: [PATCH 08/29] Spawn eggs use IsGameMode() Possible fix for #316. --- src/Items/ItemSpawnEgg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Items/ItemSpawnEgg.h b/src/Items/ItemSpawnEgg.h index 26dd15b7d..407d655de 100644 --- a/src/Items/ItemSpawnEgg.h +++ b/src/Items/ItemSpawnEgg.h @@ -28,14 +28,14 @@ public: AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - if (a_BlockFace == BLOCK_FACE_BOTTOM) + if (a_BlockFace == BLOCK_FACE_YM) { a_BlockY--; } if (a_World->SpawnMob(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5, (cMonster::eType)(a_Item.m_ItemDamage)) >= 0) { - if (a_Player->GetGameMode() != 1) + if (!a_Player->IsGameModeCreative()) { // The mob was spawned, "use" the item: a_Player->GetInventory().RemoveOneEquippedItem(); From 008c515b4b4c0fd0bb519591c9a3054b971ccf35 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:01:52 +0000 Subject: [PATCH 09/29] Fixed trapdoors not overriding OnUse --- src/Blocks/BlockTrapdoor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 58d770d23..4682faa3b 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -32,7 +32,7 @@ public: return true; } - void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) + virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { // Flip the ON bit on/off using the XOR bitwise operation NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04); From 289e8cba211b0e3835088eb6eae4baac9963bd55 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:28:27 +0000 Subject: [PATCH 10/29] Fixed eating using wrong animation --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index bfacc3422..90d250eaa 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -572,7 +572,7 @@ void cPlayer::StartEating(void) m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS; // Send the packets: - m_World->BroadcastPlayerAnimation(*this, 5); + m_World->BroadcastPlayerAnimation(*this, 3); m_World->BroadcastEntityMetadata(*this); } From 126577214acb1f3f1eb5c99062ddbed3cf1f3756 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:33:48 +0000 Subject: [PATCH 11/29] Re-implemented redstone duplicate checking --- src/Simulator/RedstoneSimulator.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index 9fdbd1151..fef3e8b21 100644 --- a/src/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp @@ -1165,6 +1165,20 @@ void cRedstoneSimulator::SetBlockPowered(int a_BlockX, int a_BlockY, int a_Block return; } + for (PoweredBlocksList::iterator itr = m_PoweredBlocks.begin(); itr != m_PoweredBlocks.end(); ++itr) // Check powered list + { + sPoweredBlocks & Change = *itr; + + if ( + Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)) && + Change.a_SourcePos.Equals(Vector3i(a_SourceX, a_SourceY, a_SourceZ)) + ) + { + // Check for duplicates + return; + } + } + sPoweredBlocks RC; RC.a_BlockPos = Vector3i(a_BlockX, a_BlockY, a_BlockZ); RC.a_SourcePos = Vector3i(a_SourceX, a_SourceY, a_SourceZ); @@ -1194,6 +1208,21 @@ void cRedstoneSimulator::SetBlockLinkedPowered( return; } + for (LinkedBlocksList::iterator itr = m_LinkedPoweredBlocks.begin(); itr != m_LinkedPoweredBlocks.end(); ++itr) // Check linked powered list + { + sLinkedPoweredBlocks & Change = *itr; + + if ( + Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)) && + Change.a_MiddlePos.Equals(Vector3i(a_MiddleX, a_MiddleY, a_MiddleZ)) && + Change.a_SourcePos.Equals(Vector3i(a_SourceX, a_SourceY, a_SourceZ)) + ) + { + // Check for duplicates + return; + } + } + sLinkedPoweredBlocks RC; RC.a_BlockPos = Vector3i(a_BlockX, a_BlockY, a_BlockZ); RC.a_MiddlePos = Vector3i(a_MiddleX, a_MiddleY, a_MiddleZ); From e2a557f46cb564caadd750114dd4a0e8225b9b4e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:39:42 +0000 Subject: [PATCH 12/29] Added pickup invalid item check They aren't spawned at all if their itemtype isn't valid; possibly fixes the client crashing with bad pickups. --- src/World.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/World.cpp b/src/World.cpp index 7982924ae..04eab1851 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1585,6 +1585,12 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_FlyAwaySpeed /= 1000; // Pre-divide, so that we don't have to divide each time inside the loop for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) { + if (!IsValidItem(itr->m_ItemType)) + { + // Don't spawn pickup if item isn't even valid; should prevent client crashing too + continue; + } + float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); @@ -1605,6 +1611,11 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double { for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) { + if (!IsValidItem(itr->m_ItemType)) + { + continue; + } + cPickup * Pickup = new cPickup( a_BlockX, a_BlockY, a_BlockZ, *itr, IsPlayerCreated, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ From ec226e00ab8d7808af92a90bc52aa54611561582 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 20:41:58 +0000 Subject: [PATCH 13/29] Puking now uses GetEyeHeight() --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 90d250eaa..a0cf24325 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1328,7 +1328,7 @@ void cPlayer::TossItem( double vX = 0, vY = 0, vZ = 0; EulerToVector(-GetRotation(), GetPitch(), vZ, vX, vY); vY = -vY * 2 + 1.f; - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY() + 1.6f, GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player + m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player } From b115f3d636809e3cfaab80d401347a2d6e6f7df0 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 21:31:55 +0000 Subject: [PATCH 14/29] Added trapdoor cursor Y detection --- src/Blocks/BlockTrapdoor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 4682faa3b..57718b45f 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -50,12 +50,10 @@ public: a_BlockType = m_BlockType; a_BlockMeta = BlockFaceToMetaData(a_BlockFace); - /* TODO: fix CursorY issues and uncomment this if (a_CursorY > 7) { a_BlockMeta |= 0x8; } - */ return true; } From b02873172639db2ac7a494389899c2175e0ddd8f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 22:29:15 +0000 Subject: [PATCH 15/29] Fixed duplication glitch with QueueSetBlock If a coordinate was queued, and then the block there was broken, it would reappear: double items! Also now just sets meta if previous and current blocktypes matched. --- src/Blocks/BlockButton.h | 4 ++-- src/Chunk.cpp | 31 ++++++++++++++++++++++++++----- src/Chunk.h | 7 ++++--- src/ChunkMap.cpp | 4 ++-- src/ChunkMap.h | 2 +- src/World.cpp | 4 ++-- src/World.h | 2 +- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index ec897835a..c898a0466 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -18,14 +18,14 @@ public: virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { - // Flip the ON bit on/off using the XOR bitwise operation + // Set p the ON bit to on NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08); a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); // Queue a button reset (unpress) - a_World->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30); + a_World->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30, m_BlockType); } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 5c9eb892b..53c7f3a82 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -701,9 +701,30 @@ void cChunk::ProcessQueuedSetBlocks(void) { if (itr->m_Tick <= CurrTick) { - // Current world age is bigger than/equal to target world age - delay time reached - SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); - itr = m_SetBlockQueue.erase(itr); + if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to -1 if not specified + { + if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType) + { + // Current world age is bigger than/equal to target world age - delay time reached AND + // Previous block type was the same as current block type (to prevent duplication) + // Since blocktypes were the same, we just need to set the meta + SetMeta(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockMeta); + itr = m_SetBlockQueue.erase(itr); + LOGD("Successfully set queued block - previous and current types matched"); + } + else + { + itr = m_SetBlockQueue.erase(itr); + LOGD("Failure setting queued block - previous and current blocktypes didn't match"); + } + } + else + { + // Current world age is bigger than/equal to target world age - delay time reached + SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); + itr = m_SetBlockQueue.erase(itr); + LOGD("Successfully set queued block - previous type ignored"); + } } else { @@ -1410,9 +1431,9 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, -void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick) +void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType) { - m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick)); + m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick, a_PreviousBlockType)); } diff --git a/src/Chunk.h b/src/Chunk.h index f13eb9a03..7ff14024c 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -149,7 +149,7 @@ public: void SetBlock( const Vector3i & a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) { SetBlock( a_RelBlockPos.x, a_RelBlockPos.y, a_RelBlockPos.z, a_BlockType, a_BlockMeta ); } /// Queues a block change till the specified world tick - void QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick); + void QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR); /// Queues block for ticking (m_ToTickQueue) void QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ); @@ -363,9 +363,10 @@ private: BLOCKTYPE m_BlockType; NIBBLETYPE m_BlockMeta; Int64 m_Tick; + BLOCKTYPE m_PreviousType; - sSetBlockQueueItem(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick) : - m_RelX(a_RelX), m_RelY(a_RelY), m_RelZ(a_RelZ), m_BlockType(a_BlockType), m_BlockMeta(a_BlockMeta), m_Tick(a_Tick) + sSetBlockQueueItem(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType) : + m_RelX(a_RelX), m_RelY(a_RelY), m_RelZ(a_RelZ), m_BlockType(a_BlockType), m_BlockMeta(a_BlockMeta), m_Tick(a_Tick), m_PreviousType(a_PreviousBlockType) { } } ; diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index a6caa5ef7..f3241bd54 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1173,7 +1173,7 @@ void cChunkMap::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_B -void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick) +void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType) { int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ); @@ -1182,7 +1182,7 @@ void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYP cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); if ((Chunk != NULL) && Chunk->IsValid()) { - Chunk->QueueSetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_Tick); + Chunk->QueueSetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_Tick, a_PreviousBlockType); } } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index b3fe25393..2a529f43d 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -138,7 +138,7 @@ public: NIBBLETYPE GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ); void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockMeta); void SetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta); - void QueueSetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick); + void QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR); bool GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); bool GetBlockInfo (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight); diff --git a/src/World.cpp b/src/World.cpp index 04eab1851..0cf34b861 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1470,9 +1470,9 @@ void cWorld::FastSetBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBB -void cWorld::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay) +void cWorld::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType) { - m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, GetWorldAge() + a_TickDelay); + m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, GetWorldAge() + a_TickDelay, a_PreviousBlockType); } diff --git a/src/World.h b/src/World.h index ea0db53e6..c865bb73f 100644 --- a/src/World.h +++ b/src/World.h @@ -317,7 +317,7 @@ public: /** Queues a SetBlock() with the specified parameters after the specified number of ticks. Calls SetBlock(), so performs full processing of the replaced block. */ - void QueueSetBlock(int a_BlockX, int a_BLockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay); + void QueueSetBlock(int a_BlockX, int a_BLockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR); BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ); NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ); From a5dd0e2b886261aeb04ca9cbbe981719dd97e99b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 22:45:55 +0000 Subject: [PATCH 16/29] Fixed bed leave animation --- src/ClientHandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index bcd0f7192..7511ab8b5 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1276,7 +1276,7 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID) } case 3: // Leave bed { - m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, 3); + m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, 2); break; } case 4: // Start sprinting From 30ead790490f04248b861db79fddde9148b552f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 6 Dec 2013 23:47:07 +0000 Subject: [PATCH 17/29] Renamed animation function Renamed BroadcastPlayerAnimation to BroadcastEntityAnimation. Not just players can have animations, you know. --- src/Bindings.cpp | 43 ++++++++++++++++++++++++++--- src/Bindings.h | 2 +- src/Chunk.cpp | 4 +-- src/Chunk.h | 2 +- src/ChunkMap.cpp | 6 ++-- src/ChunkMap.h | 2 +- src/ClientHandle.cpp | 14 +++++----- src/ClientHandle.h | 2 +- src/Entities/Player.cpp | 6 ++-- src/Plugin.h | 2 +- src/PluginLua.cpp | 8 +++--- src/PluginLua.h | 2 +- src/PluginManager.cpp | 6 ++-- src/PluginManager.h | 4 +-- src/Protocol/Protocol.h | 2 +- src/Protocol/Protocol125.cpp | 4 +-- src/Protocol/Protocol125.h | 2 +- src/Protocol/Protocol17x.cpp | 4 +-- src/Protocol/Protocol17x.h | 2 +- src/Protocol/ProtocolRecognizer.cpp | 4 +-- src/Protocol/ProtocolRecognizer.h | 2 +- src/World.cpp | 4 +-- src/World.h | 2 +- 23 files changed, 82 insertions(+), 47 deletions(-) diff --git a/src/Bindings.cpp b/src/Bindings.cpp index 6bee7d71d..51a1dbd71 100644 --- a/src/Bindings.cpp +++ b/src/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/30/13 15:42:56. +** Generated automatically by tolua++-1.0.92 on 12/06/13 23:06:37. */ #ifndef __cplusplus @@ -11803,6 +11803,38 @@ static int tolua_AllToLua_cWorld_IsDeepSnowEnabled00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: ShouldLavaSpawnFire of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_ShouldLavaSpawnFire00 +static int tolua_AllToLua_cWorld_ShouldLavaSpawnFire00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShouldLavaSpawnFire'", NULL); +#endif + { + bool tolua_ret = (bool) self->ShouldLavaSpawnFire(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ShouldLavaSpawnFire'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetDimension of class cWorld */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetDimension00 static int tolua_AllToLua_cWorld_GetDimension00(lua_State* tolua_S) @@ -12193,7 +12225,8 @@ static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S) !tolua_isnumber(tolua_S,5,0,&tolua_err) || !tolua_isnumber(tolua_S,6,0,&tolua_err) || !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) + !tolua_isnumber(tolua_S,8,1,&tolua_err) || + !tolua_isnoobj(tolua_S,9,&tolua_err) ) goto tolua_lerror; else @@ -12206,11 +12239,12 @@ static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S) unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); int a_TickDelay = ((int) tolua_tonumber(tolua_S,7,0)); + unsigned char a_PreviousBlockType = (( unsigned char) tolua_tonumber(tolua_S,8,E_BLOCK_AIR)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSetBlock'", NULL); #endif { - self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay); + self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay,a_PreviousBlockType); } } return 0; @@ -30765,6 +30799,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP); tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE); tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT); + tolua_constant(tolua_S,"HOOK_ENTITY_ANIMATION",cPluginManager::HOOK_ENTITY_ANIMATION); tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND); tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED); tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING); @@ -30773,7 +30808,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"HOOK_HOPPER_PUSHING_ITEM",cPluginManager::HOOK_HOPPER_PUSHING_ITEM); tolua_constant(tolua_S,"HOOK_KILLING",cPluginManager::HOOK_KILLING); tolua_constant(tolua_S,"HOOK_LOGIN",cPluginManager::HOOK_LOGIN); - tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION); tolua_constant(tolua_S,"HOOK_PLAYER_BREAKING_BLOCK",cPluginManager::HOOK_PLAYER_BREAKING_BLOCK); tolua_constant(tolua_S,"HOOK_PLAYER_BROKEN_BLOCK",cPluginManager::HOOK_PLAYER_BROKEN_BLOCK); tolua_constant(tolua_S,"HOOK_PLAYER_EATING",cPluginManager::HOOK_PLAYER_EATING); @@ -30855,6 +30889,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cWorld_IsGameModeAdventure00); tolua_function(tolua_S,"IsPVPEnabled",tolua_AllToLua_cWorld_IsPVPEnabled00); tolua_function(tolua_S,"IsDeepSnowEnabled",tolua_AllToLua_cWorld_IsDeepSnowEnabled00); + tolua_function(tolua_S,"ShouldLavaSpawnFire",tolua_AllToLua_cWorld_ShouldLavaSpawnFire00); tolua_function(tolua_S,"GetDimension",tolua_AllToLua_cWorld_GetDimension00); tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cWorld_GetHeight00); tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cWorld_BroadcastChat00); diff --git a/src/Bindings.h b/src/Bindings.h index 4b6fbb322..f199b58b1 100644 --- a/src/Bindings.h +++ b/src/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/30/13 15:42:57. +** Generated automatically by tolua++-1.0.92 on 12/06/13 23:06:38. */ /* Exported function */ diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 53c7f3a82..1c03753c7 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -2668,7 +2668,7 @@ void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand -void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude) { for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) { @@ -2676,7 +2676,7 @@ void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation { continue; } - (*itr)->SendPlayerAnimation(a_Player, a_Animation); + (*itr)->SendEntityAnimation(a_Entity, a_Animation); } // for itr - LoadedByClient[] } diff --git a/src/Chunk.h b/src/Chunk.h index 7ff14024c..9e5d117c5 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -271,7 +271,7 @@ public: void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - void BroadcastPlayerAnimation (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL); + void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL); void BroadcastSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // a_Src coords are Block * 8 void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index f3241bd54..3ad02ac0e 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -573,16 +573,16 @@ void cChunkMap::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientH -void cChunkMap::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +void cChunkMap::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Player.GetChunkX(), ZERO_CHUNK_Y, a_Player.GetChunkZ()); + 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->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); + Chunk->BroadcastEntityAnimation(a_Entity, a_Animation, a_Exclude); } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 2a529f43d..ef070194b 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -70,7 +70,7 @@ public: void BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - void BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL); + void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL); void BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // a_Src coords are Block * 8 void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); void BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 7511ab8b5..f11b7b85f 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1053,13 +1053,13 @@ void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_ void cClientHandle::HandleAnimation(char a_Animation) { - if (cPluginManager::Get()->CallHookPlayerAnimation(*m_Player, a_Animation)) + if (cPluginManager::Get()->CallHookEntityAnimation(*m_Player, a_Animation)) { // Plugin disagrees, bail out return; } - m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, a_Animation, this); + m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, a_Animation, this); } @@ -1264,19 +1264,19 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID) switch (a_ActionID) { - case 1: // crouch + case 1: // Crouch { m_Player->SetCrouch(true); break; } - case 2: // uncrouch + case 2: // Uncrouch { m_Player->SetCrouch(false); break; } case 3: // Leave bed { - m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, 2); + m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2); break; } case 4: // Start sprinting @@ -1813,9 +1813,9 @@ void cClientHandle::SendPickupSpawn(const cPickup & a_Pickup) -void cClientHandle::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation) +void cClientHandle::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { - m_Protocol->SendPlayerAnimation(a_Player, a_Animation); + m_Protocol->SendEntityAnimation(a_Entity, a_Animation); } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index b3550110d..4498c15c2 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -114,7 +114,7 @@ public: void SendHealth (void); void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item); void SendPickupSpawn (const cPickup & a_Pickup); - void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation); + void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline); void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+) void SendPlayerMoveLook (void); diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index a0cf24325..4684567e6 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -572,7 +572,7 @@ void cPlayer::StartEating(void) m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS; // Send the packets: - m_World->BroadcastPlayerAnimation(*this, 3); + m_World->BroadcastEntityAnimation(*this, 3); m_World->BroadcastEntityMetadata(*this); } @@ -587,7 +587,7 @@ void cPlayer::FinishEating(void) // Send the packets: m_ClientHandle->SendEntityStatus(*this, ENTITY_STATUS_EATING_ACCEPTED); - m_World->BroadcastPlayerAnimation(*this, 0); + m_World->BroadcastEntityAnimation(*this, 0); m_World->BroadcastEntityMetadata(*this); // consume the item: @@ -616,7 +616,7 @@ void cPlayer::FinishEating(void) void cPlayer::AbortEating(void) { m_EatingFinishTick = -1; - m_World->BroadcastPlayerAnimation(*this, 0); + m_World->BroadcastEntityAnimation(*this, 0); m_World->BroadcastEntityMetadata(*this); } diff --git a/src/Plugin.h b/src/Plugin.h index ec55e256d..8dd68e6f1 100644 --- a/src/Plugin.h +++ b/src/Plugin.h @@ -65,7 +65,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) = 0; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) = 0; - virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0; + virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) = 0; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; diff --git a/src/PluginLua.cpp b/src/PluginLua.cpp index 110010087..7fc7bc5f1 100644 --- a/src/PluginLua.cpp +++ b/src/PluginLua.cpp @@ -550,14 +550,14 @@ bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const -bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation) +bool cPluginLua::OnEntityAnimation(cEntity & a_Entity, int a_Animation) { cCSLock Lock(m_CriticalSection); bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION]; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ANIMATION]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Entity, a_Animation, cLuaState::Return, res); if (res) { return true; @@ -1287,11 +1287,11 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup"; case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; + case cPluginManager::HOOK_ENTITY_ANIMATION: return "OnEntityAnimation"; case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; case cPluginManager::HOOK_KILLING: return "OnKilling"; case cPluginManager::HOOK_LOGIN: return "OnLogin"; - case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock"; case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating"; diff --git a/src/PluginLua.h b/src/PluginLua.h index 6d135ab75..95e7e789f 100644 --- a/src/PluginLua.h +++ b/src/PluginLua.h @@ -61,7 +61,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override; - virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; + virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index b57a9d7d8..5bf8a0232 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -603,16 +603,16 @@ bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersi -bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation) +bool cPluginManager::CallHookEntityAnimation(cEntity & a_Entity, int a_Animation) { - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION); + HookMap::iterator Plugins = m_Hooks.find(HOOK_ENTITY_ANIMATION); if (Plugins == m_Hooks.end()) { return false; } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnPlayerAnimation(a_Player, a_Animation)) + if ((*itr)->OnEntityAnimation(a_Entity, a_Animation)) { return true; } diff --git a/src/PluginManager.h b/src/PluginManager.h index 12e4da71b..d2694e818 100644 --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -68,6 +68,7 @@ public: // tolua_export HOOK_COLLECTING_PICKUP, HOOK_CRAFTING_NO_RECIPE, HOOK_DISCONNECT, + HOOK_ENTITY_ANIMATION, HOOK_EXECUTE_COMMAND, HOOK_EXPLODED, HOOK_EXPLODING, @@ -76,7 +77,6 @@ public: // tolua_export HOOK_HOPPER_PUSHING_ITEM, HOOK_KILLING, HOOK_LOGIN, - HOOK_PLAYER_ANIMATION, HOOK_PLAYER_BREAKING_BLOCK, HOOK_PLAYER_BROKEN_BLOCK, HOOK_PLAYER_EATING, @@ -162,7 +162,7 @@ public: // tolua_export bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum); bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer); bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username); - bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation); + bool CallHookEntityAnimation (cEntity & a_Entity, int a_Animation); bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 9d8183361..ff6541aeb 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -79,7 +79,7 @@ public: virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0; virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0; virtual void SendPlayerAbilities (void) = 0; - virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) = 0; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0; virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) = 0; virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+) virtual void SendPlayerMoveLook (void) = 0; diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index b1dd17ea1..9334e6f2d 100644 --- a/src/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp @@ -578,11 +578,11 @@ void cProtocol125::SendPickupSpawn(const cPickup & a_Pickup) -void cProtocol125::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation) +void cProtocol125::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { cCSLock Lock(m_CSPacket); WriteByte(PACKET_ANIMATION); - WriteInt (a_Player.GetUniqueID()); + WriteInt (a_Entity.GetUniqueID()); WriteByte(a_Animation); Flush(); } diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 5a9218f5b..32efef4e8 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -55,7 +55,7 @@ public: virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message - virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; virtual void SendPlayerMaxSpeed (void) override; virtual void SendPlayerMoveLook (void) override; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 5f5864f2a..68f15cb69 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -489,10 +489,10 @@ void cProtocol172::SendPlayerAbilities(void) -void cProtocol172::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation) +void cProtocol172::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { cPacketizer Pkt(*this, 0x0b); // Animation packet - Pkt.WriteVarInt(a_Player.GetUniqueID()); + Pkt.WriteVarInt(a_Entity.GetUniqueID()); Pkt.WriteChar(a_Animation); } diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index 9c1eaa99a..9a189ab24 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -64,7 +64,7 @@ public: virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override; - virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; virtual void SendPlayerMaxSpeed (void) override; virtual void SendPlayerMoveLook (void) override; diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 489149d74..683700d37 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -396,10 +396,10 @@ void cProtocolRecognizer::SendPlayerAbilities(void) -void cProtocolRecognizer::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation) +void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) { ASSERT(m_Protocol != NULL); - m_Protocol->SendPlayerAnimation(a_Player, a_Animation); + m_Protocol->SendEntityAnimation(a_Entity, a_Animation); } diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 9ca0c1c88..83fc23c22 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -90,7 +90,7 @@ public: virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override; - virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; virtual void SendPlayerMaxSpeed (void) override; virtual void SendPlayerMoveLook (void) override; diff --git a/src/World.cpp b/src/World.cpp index 0cf34b861..2da4a89be 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1858,9 +1858,9 @@ void cWorld::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand -void cWorld::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +void cWorld::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude) { - m_ChunkMap->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); + m_ChunkMap->BroadcastEntityAnimation(a_Entity, a_Animation, a_Exclude); } diff --git a/src/World.h b/src/World.h index c865bb73f..fadb8aac6 100644 --- a/src/World.h +++ b/src/World.h @@ -159,7 +159,7 @@ public: void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - void BroadcastPlayerAnimation (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL); + void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL); void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL); void BroadcastSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // tolua_export a_Src coords are Block * 8 void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export From 347e80bdd88f894394373745859f405dc82c1819 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 00:18:58 +0000 Subject: [PATCH 18/29] Added basic ender chests Note that they just mirror chests now, so no per player inventory. --- VC2013/MCServer.vcxproj | 2 + VC2013/MCServer.vcxproj.filters | 6 ++ src/BlockEntities/BlockEntity.cpp | 22 +++-- src/BlockEntities/EnderChestEntity.cpp | 130 +++++++++++++++++++++++++ src/BlockEntities/EnderChestEntity.h | 59 +++++++++++ src/Blocks/BlockEnderchest.h | 49 +++++++++- src/Blocks/BlockFurnace.h | 1 - src/Chunk.cpp | 2 + src/UI/SlotArea.cpp | 33 +++++++ src/UI/SlotArea.h | 18 ++++ src/UI/Window.cpp | 38 ++++++++ src/UI/Window.h | 17 ++++ 12 files changed, 363 insertions(+), 14 deletions(-) create mode 100644 src/BlockEntities/EnderChestEntity.cpp create mode 100644 src/BlockEntities/EnderChestEntity.h diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index 9c640f6dd..098253ac3 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -224,6 +224,7 @@ + @@ -615,6 +616,7 @@ + diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters index be0a37dc1..4e22f5517 100644 --- a/VC2013/MCServer.vcxproj.filters +++ b/VC2013/MCServer.vcxproj.filters @@ -945,6 +945,9 @@ Source Files\HTTPServer + + Source Files\BlockEntities + @@ -1654,6 +1657,9 @@ Source Files\HTTPServer + + Source Files\BlockEntities + diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp index 41a488717..5d7e4a37a 100644 --- a/src/BlockEntities/BlockEntity.cpp +++ b/src/BlockEntities/BlockEntity.cpp @@ -8,6 +8,7 @@ #include "ChestEntity.h" #include "DispenserEntity.h" #include "DropperEntity.h" +#include "EnderChestEntity.h" #include "FurnaceEntity.h" #include "HopperEntity.h" #include "JukeboxEntity.h" @@ -22,16 +23,17 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE { switch (a_BlockType) { - case E_BLOCK_CHEST: return new cChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_DISPENSER: return new cDispenserEntity(a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); - case E_BLOCK_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); - case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_SIGN_POST: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_WALLSIGN: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_NOTE_BLOCK: return new cNoteEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); - case E_BLOCK_JUKEBOX: return new cJukeboxEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_CHEST: return new cChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_DISPENSER: return new cDispenserEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_ENDER_CHEST: return new cEnderChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); + case E_BLOCK_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World); + case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_SIGN_POST: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_WALLSIGN: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_NOTE_BLOCK: return new cNoteEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); + case E_BLOCK_JUKEBOX: return new cJukeboxEntity (a_BlockX, a_BlockY, a_BlockZ, a_World); } LOGD("%s: Requesting creation of an unknown block entity - block type %d (%s)", __FUNCTION__, a_BlockType, ItemTypeToString(a_BlockType).c_str() diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp new file mode 100644 index 000000000..e53930798 --- /dev/null +++ b/src/BlockEntities/EnderChestEntity.cpp @@ -0,0 +1,130 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "EnderChestEntity.h" +#include "../Item.h" +#include "../Entities/Player.h" +#include "../UI/Window.h" +#include "json/json.h" + + + + + +cEnderChestEntity::cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : + super(E_BLOCK_ENDER_CHEST, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World) +{ + cBlockEntityWindowOwner::SetBlockEntity(this); +} + + + + + +cEnderChestEntity::~cEnderChestEntity() +{ + cWindow * Window = GetWindow(); + if (Window != NULL) + { + Window->OwnerDestroyed(); + } +} + + + + + +bool cEnderChestEntity::LoadFromJson(const Json::Value & a_Value) +{ + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + Json::Value AllSlots = a_Value.get("Slots", 0); + int SlotIdx = 0; + for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) + { + cItem Item; + Item.FromJson(*itr); + SetSlot(SlotIdx, Item); + SlotIdx++; + } + return true; +} + + + + + +void cEnderChestEntity::SaveToJson(Json::Value & a_Value) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + Json::Value AllSlots; + for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--) + { + Json::Value Slot; + m_Contents.GetSlot(i).GetJson(Slot); + AllSlots.append(Slot); + } + a_Value["Slots"] = AllSlots; +} + + + + + +void cEnderChestEntity::SendTo(cClientHandle & a_Client) +{ + // The chest entity doesn't need anything sent to the client when it's created / gets in the viewdistance + // All the actual handling is in the cWindow UI code that gets called when the chest is rclked + + UNUSED(a_Client); +} + + + + + +void cEnderChestEntity::UsedBy(cPlayer * a_Player) +{ + // If the window is not created, open it anew: + cWindow * Window = GetWindow(); + if (Window == NULL) + { + OpenNewWindow(); + Window = GetWindow(); + } + + // Open the window for the player: + if (Window != NULL) + { + if (a_Player->GetWindow() != Window) + { + a_Player->OpenWindow(Window); + } + } + + // This is rather a hack + // Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now + // We cannot properly detect contents change, but such a change doesn't happen without a player opening the chest first. + // The few false positives aren't much to worry about + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(m_PosX, m_PosZ, ChunkX, ChunkZ); + m_World->MarkChunkDirty(ChunkX, ChunkZ); +} + + + + + +void cEnderChestEntity::OpenNewWindow(void) +{ + OpenWindow(new cEnderChestWindow(this)); +} + + + + diff --git a/src/BlockEntities/EnderChestEntity.h b/src/BlockEntities/EnderChestEntity.h new file mode 100644 index 000000000..683b652b2 --- /dev/null +++ b/src/BlockEntities/EnderChestEntity.h @@ -0,0 +1,59 @@ + +#pragma once + +#include "BlockEntityWithItems.h" +#include "../UI/WindowOwner.h" + + + + + +namespace Json +{ + class Value; +}; + +class cClientHandle; +class cServer; +class cNBTData; + + + + + +class cEnderChestEntity : // tolua_export + public cBlockEntityWindowOwner, + // tolua_begin + public cBlockEntityWithItems +{ + typedef cBlockEntityWithItems super; + +public: + enum { + ContentsHeight = 3, + ContentsWidth = 9, + } ; + + // tolua_end + + /// Constructor used for normal operation + cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); + + virtual ~cEnderChestEntity(); + + static const char * GetClassStatic(void) { return "cEnderChestEntity"; } + + bool LoadFromJson(const Json::Value & a_Value); + + // cBlockEntity overrides: + virtual void SaveToJson(Json::Value & a_Value) override; + virtual void SendTo(cClientHandle & a_Client) override; + virtual void UsedBy(cPlayer * a_Player) override; + + /// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. + void OpenNewWindow(void); +} ; // tolua_export + + + + diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 0ce813f1c..50d8e38e0 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -1,18 +1,18 @@ #pragma once -#include "BlockHandler.h" +#include "BlockEntity.h" class cBlockEnderchestHandler : - public cBlockHandler + public cBlockEntityHandler { public: cBlockEnderchestHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cBlockEntityHandler(a_BlockType) { } @@ -21,6 +21,49 @@ public: //todo: Drop Ender Chest if using silk touch pickaxe a_Pickups.push_back(cItem(E_BLOCK_OBSIDIAN, 8, 0)); } + + virtual bool GetPlacementBlockTypeMeta( + cWorld * a_World, cPlayer * a_Player, + int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, + int a_CursorX, int a_CursorY, int a_CursorZ, + BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta + ) override + { + a_BlockType = m_BlockType; + a_BlockMeta = RotationToMetaData(a_Player->GetRotation()); + return true; + } + + virtual const char * GetStepSound(void) override + { + return "step.stone"; + } + + static NIBBLETYPE RotationToMetaData(double a_Rotation) + { + a_Rotation += 90 + 45; // So its not aligned with axis + + if (a_Rotation > 360.f) + { + a_Rotation -= 360.f; + } + if ((a_Rotation >= 0.f) && (a_Rotation < 90.f)) + { + return 0x4; + } + else if ((a_Rotation >= 180) && (a_Rotation < 270)) + { + return 0x5; + } + else if ((a_Rotation >= 90) && (a_Rotation < 180)) + { + return 0x2; + } + else + { + return 0x3; + } + } } ; diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index fe35893d5..5b067d7b7 100644 --- a/src/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h @@ -4,7 +4,6 @@ #include "BlockEntity.h" #include "../World.h" #include "../Piston.h" -#include "../Entities/Player.h" diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 1c03753c7..4eb11718d 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1301,6 +1301,7 @@ void cChunk::CreateBlockEntities(void) case E_BLOCK_CHEST: case E_BLOCK_DISPENSER: case E_BLOCK_DROPPER: + case E_BLOCK_ENDER_CHEST: case E_BLOCK_LIT_FURNACE: case E_BLOCK_FURNACE: case E_BLOCK_HOPPER: @@ -1413,6 +1414,7 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, case E_BLOCK_CHEST: case E_BLOCK_DISPENSER: case E_BLOCK_DROPPER: + case E_BLOCK_ENDER_CHEST: case E_BLOCK_LIT_FURNACE: case E_BLOCK_FURNACE: case E_BLOCK_HOPPER: diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 7fd7cd996..e743f4bb3 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -8,6 +8,7 @@ #include "../Entities/Player.h" #include "../BlockEntities/ChestEntity.h" #include "../BlockEntities/DropSpenserEntity.h" +#include "../BlockEntities/EnderChestEntity.h" #include "../BlockEntities/FurnaceEntity.h" #include "../Items/ItemHandler.h" #include "Window.h" @@ -556,6 +557,38 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player) +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cSlotAreaEnderChest: + +cSlotAreaEnderChest::cSlotAreaEnderChest(cEnderChestEntity * a_EnderChest, cWindow & a_ParentWindow) : + cSlotArea(27, a_ParentWindow), + m_EnderChest(a_EnderChest) +{ +} + + + + + +const cItem * cSlotAreaEnderChest::GetSlot(int a_SlotNum, cPlayer & a_Player) const +{ + // a_SlotNum ranges from 0 to 26, use that to index the chest entity's inventory directly: + return &(m_EnderChest->GetSlot(a_SlotNum)); +} + + + + + +void cSlotAreaEnderChest::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) +{ + m_EnderChest->SetSlot(a_SlotNum, a_Item); +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cSlotAreaFurnace: diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h index b1944d901..d31c87e0c 100644 --- a/src/UI/SlotArea.h +++ b/src/UI/SlotArea.h @@ -16,6 +16,7 @@ class cWindow; class cPlayer; class cChestEntity; class cDropSpenserEntity; +class cEnderChestEntity; class cFurnaceEntity; class cCraftingRecipe; @@ -286,6 +287,23 @@ protected: +class cSlotAreaEnderChest : + public cSlotArea +{ +public: + cSlotAreaEnderChest(cEnderChestEntity * a_EnderChest, cWindow & a_ParentWindow); + + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + +protected: + cEnderChestEntity * m_EnderChest; +}; + + + + + class cSlotAreaFurnace : public cSlotArea, public cItemGrid::cListener diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp index f5c62692f..5ca31fa3e 100644 --- a/src/UI/Window.cpp +++ b/src/UI/Window.cpp @@ -11,6 +11,7 @@ #include "../Items/ItemHandler.h" #include "../BlockEntities/ChestEntity.h" #include "../BlockEntities/DropSpenserEntity.h" +#include "../BlockEntities/EnderChestEntity.h" #include "../BlockEntities/HopperEntity.h" @@ -853,6 +854,43 @@ cDropSpenserWindow::cDropSpenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cEnderChestWindow: + +cEnderChestWindow::cEnderChestWindow(cEnderChestEntity * a_EnderChest) : + cWindow(wtChest, "Ender Chest"), + m_World(a_EnderChest->GetWorld()), + m_BlockX(a_EnderChest->GetPosX()), + m_BlockY(a_EnderChest->GetPosY()), + m_BlockZ(a_EnderChest->GetPosZ()) +{ + m_SlotAreas.push_back(new cSlotAreaEnderChest(a_EnderChest, *this)); + m_SlotAreas.push_back(new cSlotAreaInventory(*this)); + m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); + + // Play the opening sound: + m_World->BroadcastSoundEffect("random.chestopen", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1); + + // Send out the chest-open packet: + m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_ENDER_CHEST); +} + + + + + +cEnderChestWindow::~cEnderChestWindow() +{ + // Send out the chest-close packet: + m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 0, E_BLOCK_ENDER_CHEST); + + m_World->BroadcastSoundEffect("random.chestclosed", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1); +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cHopperWindow: diff --git a/src/UI/Window.h b/src/UI/Window.h index c44b900d7..030182888 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -20,6 +20,7 @@ class cWindowOwner; class cClientHandle; class cChestEntity; class cDropSpenserEntity; +class cEnderChestEntity; class cFurnaceEntity; class cHopperEntity; class cSlotArea; @@ -283,6 +284,22 @@ protected: +class cEnderChestWindow : + public cWindow +{ +public: + cEnderChestWindow(cEnderChestEntity * a_EnderChest); + ~cEnderChestWindow(); + +protected: + cWorld * m_World; + int m_BlockX, m_BlockY, m_BlockZ; // Position of the enderchest, for the window-close packet +}; + + + + + class cInventoryWindow : public cWindow { From 1932cc38a1fba31a61be2f1a5d17ced46d5915ad Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 14:41:58 +0000 Subject: [PATCH 19/29] Fixed trapdoors not toggling The redstone simulator kept on resetting them. --- src/ClientHandle.cpp | 2 +- src/Simulator/RedstoneSimulator.cpp | 106 +++++++++++++++++++++++----- src/Simulator/RedstoneSimulator.h | 12 ++++ 3 files changed, 103 insertions(+), 17 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index f11b7b85f..eba895fcd 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -205,7 +205,7 @@ void cClientHandle::Kick(const AString & a_Reason) { if (m_State >= csAuthenticating) // Don't log pings { - LOG("Kicking user \"%s\" for \"%s\"", m_Username.c_str(), StripColorCodes(a_Reason).c_str()); + LOGINFO("Kicking player %s for \"%s\"", m_Username.c_str(), StripColorCodes(a_Reason).c_str()); } SendDisconnect(a_Reason); } diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index fef3e8b21..771be6ac1 100644 --- a/src/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp @@ -160,6 +160,29 @@ void cRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, c } } + for (SimulatedPlayerToggleableList::iterator itr = m_SimulatedPlayerToggleableBlocks.begin(); itr != m_SimulatedPlayerToggleableBlocks.end();) + { + sSimulatedPlayerToggleableList & Change = *itr; + + int RelX = Change.a_BlockPos.x - a_ChunkX * cChunkDef::Width; + int RelZ = Change.a_BlockPos.z - a_ChunkZ * cChunkDef::Width; + + BLOCKTYPE SourceBlockType; + if (!a_Chunk->UnboundedRelGetBlockType(RelX, Change.a_BlockPos.y, RelZ, SourceBlockType)) + { + continue; + } + else if (!IsAllowedBlock(SourceBlockType)) + { + LOGD("cRedstoneSimulator: Erased block %s from toggleable simulated list due to power state change", ItemToFullString(SourceBlockType).c_str()); + itr = m_SimulatedPlayerToggleableBlocks.erase(itr); + } + else + { + ++itr; + } + } + for (cRedstoneSimulatorChunkData::iterator dataitr = ChunkData.begin(), end = ChunkData.end(); dataitr != end;) { BLOCKTYPE BlockType = a_Chunk->GetBlock(dataitr->x, dataitr->y, dataitr->z); @@ -314,7 +337,6 @@ void cRedstoneSimulator::HandleRedstoneTorch(int a_BlockX, int a_BlockY, int a_B // Block torch on not powered, can be turned on again! m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_TORCH_ON, m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ)); } - return; } @@ -325,7 +347,6 @@ void cRedstoneSimulator::HandleRedstoneBlock(int a_BlockX, int a_BlockY, int a_B { SetAllDirsAsPowered(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BLOCK_OF_REDSTONE); SetBlockPowered(a_BlockX, a_BlockY, a_BlockZ, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BLOCK_OF_REDSTONE); // Set self as powered - return; } @@ -345,7 +366,6 @@ void cRedstoneSimulator::HandleRedstoneLever(int a_BlockX, int a_BlockY, int a_B SetDirectionLinkedPowered(a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_ZM, E_BLOCK_LEVER); SetDirectionLinkedPowered(a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_ZP, E_BLOCK_LEVER); } - return; } @@ -497,7 +517,6 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl } } } - return; } @@ -556,7 +575,6 @@ void cRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_BlockY, int m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_REPEATER_OFF, a_Meta); } } - return; } @@ -574,7 +592,6 @@ void cRedstoneSimulator::HandlePiston(int a_BlockX, int a_BlockY, int a_BlockZ) { Piston.RetractPiston(a_BlockX, a_BlockY, a_BlockZ); } - return; } @@ -598,7 +615,6 @@ void cRedstoneSimulator::HandleDropSpenser(int a_BlockX, int a_BlockY, int a_Blo } DrSpSP (AreCoordsPowered(a_BlockX, a_BlockY, a_BlockZ)); m_World.DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, DrSpSP); - return; } @@ -621,7 +637,6 @@ void cRedstoneSimulator::HandleRedstoneLamp(int a_BlockX, int a_BlockY, int a_Bl m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_LAMP_OFF, 0); } } - return; } @@ -636,7 +651,6 @@ void cRedstoneSimulator::HandleTNT(int a_BlockX, int a_BlockY, int a_BlockZ) m_World.SpawnPrimedTNT(a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 4); // 4 seconds to boom m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); } - return; } @@ -689,7 +703,6 @@ void cRedstoneSimulator::HandleDoor(int a_BlockX, int a_BlockY, int a_BlockZ) } } } - return; } @@ -732,11 +745,19 @@ void cRedstoneSimulator::HandleTrapdoor(int a_BlockX, int a_BlockY, int a_BlockZ { if (AreCoordsPowered(a_BlockX, a_BlockY, a_BlockZ)) { - m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x4); + if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, true)) + { + m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x4); + SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, true); + } } else { - m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0xB); // Take into account that the fourth bit is needed for trapdoors too + if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, false)) + { + m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0xB); // Take into account that the fourth bit is needed for trapdoors too + SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, false); + } } } @@ -892,6 +913,31 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block +bool cRedstoneSimulator::AreCoordsSimulated(int a_BlockX, int a_BlockY, int a_BlockZ, bool IsCurrentStatePowered) +{ + for (SimulatedPlayerToggleableList::iterator itr = m_SimulatedPlayerToggleableBlocks.begin(); itr != m_SimulatedPlayerToggleableBlocks.end(); ++itr) + { + sSimulatedPlayerToggleableList & Change = *itr; + + if (Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) + { + if (Change.WasLastStatePowered != IsCurrentStatePowered) // Was the last power state different to the current? + { + return false; // It was, coordinates are no longer simulated + } + else + { + return true; // It wasn't, don't resimulate block, and allow players to toggle + } + } + } + return false; // Block wasn't even in the list, not simulated +} + + + + + void cRedstoneSimulator::SetDirectionLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Direction, BLOCKTYPE a_SourceType) { switch (a_Direction) @@ -1124,7 +1170,6 @@ void cRedstoneSimulator::SetDirectionLinkedPowered(int a_BlockX, int a_BlockY, i break; } } - return; } @@ -1150,7 +1195,6 @@ void cRedstoneSimulator::SetAllDirsAsPowered(int a_BlockX, int a_BlockY, int a_B { SetBlockPowered(a_BlockX + gCrossCoords[i].x, a_BlockY + gCrossCoords[i].y, a_BlockZ + gCrossCoords[i].z, a_BlockX, a_BlockY, a_BlockZ, a_SourceBlock); } - return; } @@ -1184,7 +1228,6 @@ void cRedstoneSimulator::SetBlockPowered(int a_BlockX, int a_BlockY, int a_Block RC.a_SourcePos = Vector3i(a_SourceX, a_SourceY, a_SourceZ); RC.a_SourceBlock = a_SourceBlock; m_PoweredBlocks.push_back(RC); - return; } @@ -1230,7 +1273,38 @@ void cRedstoneSimulator::SetBlockLinkedPowered( RC.a_SourceBlock = a_SourceBlock; RC.a_MiddleBlock = a_MiddleBlock; m_LinkedPoweredBlocks.push_back(RC); - return; +} + + + + + +void cRedstoneSimulator::SetPlayerToggleableBlockAsSimulated(int a_BlockX, int a_BlockY, int a_BlockZ, bool WasLastStatePowered) +{ + for (SimulatedPlayerToggleableList::iterator itr = m_SimulatedPlayerToggleableBlocks.begin(); itr != m_SimulatedPlayerToggleableBlocks.end(); ++itr) + { + sSimulatedPlayerToggleableList & Change = *itr; + + if (Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) + { + if (Change.WasLastStatePowered != WasLastStatePowered) + { + // If power states different, erase the old listing in preparation to add new one + m_SimulatedPlayerToggleableBlocks.erase(itr); + break; + } + else + { + // If states the same, just ignore + return; + } + } + } + + sSimulatedPlayerToggleableList RC; + RC.a_BlockPos = Vector3i(a_BlockX, a_BlockY, a_BlockZ); + RC.WasLastStatePowered = WasLastStatePowered; + m_SimulatedPlayerToggleableBlocks.push_back(RC); } diff --git a/src/Simulator/RedstoneSimulator.h b/src/Simulator/RedstoneSimulator.h index 59400b614..e094150e8 100644 --- a/src/Simulator/RedstoneSimulator.h +++ b/src/Simulator/RedstoneSimulator.h @@ -50,12 +50,20 @@ private: BLOCKTYPE a_SourceBlock; BLOCKTYPE a_MiddleBlock; }; + + struct sSimulatedPlayerToggleableList + { + Vector3i a_BlockPos; + bool WasLastStatePowered; + }; typedef std::vector PoweredBlocksList; typedef std::vector LinkedBlocksList; + typedef std::vector SimulatedPlayerToggleableList; PoweredBlocksList m_PoweredBlocks; LinkedBlocksList m_LinkedPoweredBlocks; + SimulatedPlayerToggleableList m_SimulatedPlayerToggleableBlocks; virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; @@ -102,6 +110,8 @@ private: void SetBlockPowered(int a_BlockX, int a_BlockY, int a_BlockZ, int a_SourceX, int a_SourceY, int a_SourceZ, BLOCKTYPE a_SourceBlock); /// Marks a block as being powered through another block void SetBlockLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, int a_MiddleX, int a_MiddleY, int a_MiddleZ, int a_SourceX, int a_SourceY, int a_SourceZ, BLOCKTYPE a_SourceBlock, BLOCKTYPE a_MiddeBlock); + /// Marks a block as simulated, who should not be simulated further unless their power state changes, to accomodate a player manually toggling the block without triggering the simulator toggling it back + void SetPlayerToggleableBlockAsSimulated(int a_BlockX, int a_BlockY, int a_BlockZ, bool WasLastStatePowered); /// Marks the second block in a direction as linked powered void SetDirectionLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Direction, BLOCKTYPE a_SourceBlock); /// Marks all blocks immediately surrounding a coordinate as powered @@ -109,6 +119,8 @@ private: /// Returns if a coordinate is powered or linked powered bool AreCoordsPowered(int a_BlockX, int a_BlockY, int a_BlockZ); + /// Returns if a coordinate was marked as simulated (for blocks toggleable by players) + bool AreCoordsSimulated(int a_BlockX, int a_BlockY, int a_BlockZ, bool IsCurrentStatePowered); /// Returns if a repeater is powered bool IsRepeaterPowered(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta); /// Returns if a piston is powered From a61082ffee9c8182d053b4b335bd80bced376606 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 14:55:19 +0000 Subject: [PATCH 20/29] Changed some FastSetBlocks to SetBlock Should fix some duplication glitches. --- src/Simulator/RedstoneSimulator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index 771be6ac1..63e4f04a8 100644 --- a/src/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp @@ -627,14 +627,14 @@ void cRedstoneSimulator::HandleRedstoneLamp(int a_BlockX, int a_BlockY, int a_Bl { if (AreCoordsPowered(a_BlockX, a_BlockY, a_BlockZ)) { - m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_LAMP_ON, 0); + m_World.SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_LAMP_ON, 0); } } else { if (!AreCoordsPowered(a_BlockX, a_BlockY, a_BlockZ)) { - m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_LAMP_OFF, 0); + m_World.SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_LAMP_OFF, 0); } } } @@ -649,7 +649,7 @@ void cRedstoneSimulator::HandleTNT(int a_BlockX, int a_BlockY, int a_BlockZ) { m_World.BroadcastSoundEffect("random.fuse", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.6f); m_World.SpawnPrimedTNT(a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 4); // 4 seconds to boom - m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); + m_World.SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); } } From 5bed85aba0720dc22db56dcaec28675c189491c4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 18:03:56 +0000 Subject: [PATCH 21/29] Fixed some new 1.7 client crash bugs Some technical blocks were removed; trying to render them as items caused a crash. --- VC2013/MCServer.vcxproj | 1 + VC2013/MCServer.vcxproj.filters | 3 +++ src/Blocks/BlockHandler.cpp | 2 ++ src/Blocks/BlockPiston.h | 6 ++++++ src/Blocks/BlockRedstoneLamp.h | 27 +++++++++++++++++++++++++++ src/Piston.cpp | 3 ++- 6 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/Blocks/BlockRedstoneLamp.h diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index 098253ac3..07e1ffb4a 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -225,6 +225,7 @@ + diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters index 4e22f5517..2f0794e85 100644 --- a/VC2013/MCServer.vcxproj.filters +++ b/VC2013/MCServer.vcxproj.filters @@ -948,6 +948,9 @@ Source Files\BlockEntities + + Source Files\Blocks + diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 4a6d49449..43f9eda37 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -48,6 +48,7 @@ #include "BlockPumpkin.h" #include "BlockRail.h" #include "BlockRedstone.h" +#include "BlockRedstoneLamp.h" #include "BlockRedstoneRepeater.h" #include "BlockRedstoneTorch.h" #include "BlockSand.h" @@ -171,6 +172,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType); case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType); + case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType); case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType); case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler(a_BlockType); case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType); diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 109f5ea8b..36fa6a572 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -36,6 +36,12 @@ public: cBlockPistonHeadHandler(void); virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override; + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // No pickups + // Also with 1.7, the item forms of these tecnical blocks have been removed, so giving someone this will crash their client... + } } ; diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h new file mode 100644 index 000000000..69a2b27c2 --- /dev/null +++ b/src/Blocks/BlockRedstoneLamp.h @@ -0,0 +1,27 @@ + +#pragma once + +#include "BlockHandler.h" + + + + + +class cBlockRedstoneLampHandler : + public cBlockHandler +{ +public: + cBlockRedstoneLampHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0)); + } +}; + + + + diff --git a/src/Piston.cpp b/src/Piston.cpp index 63ffbad0b..b893af73a 100644 --- a/src/Piston.cpp +++ b/src/Piston.cpp @@ -113,7 +113,7 @@ void cPiston::ExtendPiston(int pistx, int pisty, int pistz) AddDir(pistx, pisty, pistz, pistonMeta, -1); // "pist" now at piston body, "ext" at future extension - m_World->SetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8); + m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8); m_World->QueueSetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0), PISTON_TICK_DELAY); } @@ -126,6 +126,7 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz) BLOCKTYPE pistonBlock; NIBBLETYPE pistonMeta; m_World->GetBlockTypeMeta(pistx, pisty, pistz, pistonBlock, pistonMeta); + if (!IsExtended(pistonMeta)) { // Already retracted, bail out From 16db8533e1a9cde333d64dc5a8c8722aa15556cb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 20:29:09 +0000 Subject: [PATCH 22/29] Improved piston animations --- src/Piston.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Piston.cpp b/src/Piston.cpp index b893af73a..b15e7d95e 100644 --- a/src/Piston.cpp +++ b/src/Piston.cpp @@ -15,7 +15,7 @@ /// Number of ticks that the piston extending / retracting waits before setting the block -const int PISTON_TICK_DELAY = 6; +const int PISTON_TICK_DELAY = 1; @@ -142,16 +142,16 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz) } AddDir(pistx, pisty, pistz, pistonMeta, -1); - m_World->BroadcastBlockAction(pistx, pisty, pistz, 1, pistonMeta & ~(8), pistonBlock); - m_World->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f); m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8)); + m_World->BroadcastBlockAction(pistx, pisty, pistz, 1, pistonMeta & ~(8), pistonBlock); + m_World->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f); AddDir(pistx, pisty, pistz, pistonMeta, 1); // Retract the extension, pull block if appropriate if (IsSticky(pistonBlock)) { int tempx = pistx, tempy = pisty, tempz = pistz; - AddDir( tempx, tempy, tempz, pistonMeta, 1); + AddDir(tempx, tempy, tempz, pistonMeta, 1); BLOCKTYPE tempBlock; NIBBLETYPE tempMeta; m_World->GetBlockTypeMeta(tempx, tempy, tempz, tempBlock, tempMeta); From 405f67dac83db8f7805feca6747be3bec21559af Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 22:35:01 +0000 Subject: [PATCH 23/29] Fixed water starting fires --- src/Blocks/BlockHandler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 43f9eda37..62b57139e 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -187,7 +187,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_SNOW: return new cBlockSnowHandler (a_BlockType); case E_BLOCK_SPRUCE_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_STATIONARY_LAVA: return new cBlockLavaHandler (a_BlockType); - case E_BLOCK_STATIONARY_WATER: return new cBlockLavaHandler (a_BlockType); case E_BLOCK_STICKY_PISTON: return new cBlockPistonHandler (a_BlockType); case E_BLOCK_STONE: return new cBlockStoneHandler (a_BlockType); case E_BLOCK_STONE_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); From b779d84663024751e814a324717c1b9b4dcad6a6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 22:35:24 +0000 Subject: [PATCH 24/29] Console trims its commands before executing 'em --- src/Root.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Root.cpp b/src/Root.cpp index f15bfd366..1c81878f9 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -77,11 +77,11 @@ void cRoot::InputThread(void * a_Params) while (!(self.m_bStop || self.m_bRestart) && std::cin.good()) { - std::string Command; + AString Command; std::getline(std::cin, Command); if (!Command.empty()) - { - self.ExecuteConsoleCommand(Command, Output); + { + self.ExecuteConsoleCommand(TrimString(Command), Output); } } From 838d4d5d1d9be001357d6795a343244a43652e2f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 7 Dec 2013 23:45:33 +0000 Subject: [PATCH 25/29] Bonemeal has particles, fixes #393 --- src/Items/ItemDye.h | 5 ++--- src/World.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h index 99b8d2543..190cdc510 100644 --- a/src/Items/ItemDye.h +++ b/src/Items/ItemDye.h @@ -21,14 +21,13 @@ public: virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override { - // TODO: Handle coloring the sheep, too (OnItemUseOnEntity maybe) - // Handle growing the plants: if (a_Item.m_ItemDamage == E_META_DYE_WHITE) { if (a_World->GrowRipePlant(a_BlockX, a_BlockY, a_BlockZ, true)) { - if (a_Player->GetGameMode() != gmCreative) + // Particle effects are in GrowRipePlant + if (!a_Player->IsGameModeCreative()) { a_Player->GetInventory().RemoveOneEquippedItem(); return true; diff --git a/src/World.cpp b/src/World.cpp index 2da4a89be..41f08d97f 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1259,6 +1259,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy if (BlockMeta < 7) { FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0); } return true; } @@ -1272,6 +1273,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy if (BlockMeta < 7) { FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0); } return true; } @@ -1285,6 +1287,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy return false; } FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0); } else { @@ -1306,6 +1309,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy if (BlockMeta < 7) { FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0); } return true; } @@ -1319,6 +1323,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy return false; } FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0); } else { @@ -1377,6 +1382,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(2005, a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, 0); } // for i - 50 times return true; } From 0148685d4ea47c9f81fabb5065fd733e00441da8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 8 Dec 2013 00:32:02 +0000 Subject: [PATCH 26/29] Fixed falling block metas, fixes #406 --- src/Protocol/Protocol17x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 68f15cb69..233155c90 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -664,7 +664,7 @@ void cProtocol172::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) Pkt.WriteFPInt(a_FallingBlock.GetPosZ()); Pkt.WriteByteAngle(a_FallingBlock.GetYaw()); Pkt.WriteByteAngle(a_FallingBlock.GetPitch()); - Pkt.WriteInt(((int)a_FallingBlock.GetBlockType()) | (((int)a_FallingBlock.GetBlockMeta()) << 12)); + Pkt.WriteInt(((int)a_FallingBlock.GetBlockType()) | (((int)a_FallingBlock.GetBlockMeta()) << 16)); // Or 0x10 Pkt.WriteShort((short)(a_FallingBlock.GetSpeedX() * 400)); Pkt.WriteShort((short)(a_FallingBlock.GetSpeedY() * 400)); Pkt.WriteShort((short)(a_FallingBlock.GetSpeedZ() * 400)); From f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 8 Dec 2013 13:37:10 +0000 Subject: [PATCH 27/29] Fixed tabcompletion packet, fixes #356 --- src/Protocol/Protocol17x.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 233155c90..75983e9a3 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -744,17 +744,13 @@ void cProtocol172::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp void cProtocol172::SendTabCompletionResults(const AStringVector & a_Results) { - AString Results; - Results.reserve(500); // Make a moderate reservation to avoid excessive reallocations - for (AStringVector::const_iterator itr = a_Results.begin(), end = a_Results.end(); itr != end; ++itr) - { - Results.append(*itr); - Results.push_back(0); - } - cPacketizer Pkt(*this, 0x3a); // Tab-Complete packet Pkt.WriteVarInt(a_Results.size()); - Pkt.WriteString(Results); + + for (AStringVector::const_iterator itr = a_Results.begin(), end = a_Results.end(); itr != end; ++itr) + { + Pkt.WriteString(*itr); + } } From 9c1b7c8b6e43d740c55e75ec594dce2ea482f11e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 8 Dec 2013 14:07:32 +0000 Subject: [PATCH 28/29] Readded redstone lamp handler --- src/Blocks/BlockHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 37d948d79..99559ed02 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -48,6 +48,7 @@ #include "BlockPumpkin.h" #include "BlockRail.h" #include "BlockRedstone.h" +#include "BlockRedstoneLamp.h" #include "BlockRedstoneRepeater.h" #include "BlockRedstoneTorch.h" #include "BlockSand.h" @@ -169,6 +170,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType); case E_BLOCK_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType); + case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType); // We need this to change pickups to an off lamp; else 1.7+ clients crash case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType); case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType); From 166f07029da91c27c2fc1e3f7f201105c6efa062 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 8 Dec 2013 14:45:24 +0000 Subject: [PATCH 29/29] Fixed binding generation and VS2013 compile --- VC2008/GenerateBindings.cmd | 2 +- VC2013/GenerateBindings.cmd | 2 +- VC2013/MCServer.vcxproj | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/VC2008/GenerateBindings.cmd b/VC2008/GenerateBindings.cmd index 1ee0f3bf0..e247d7f4f 100644 --- a/VC2008/GenerateBindings.cmd +++ b/VC2008/GenerateBindings.cmd @@ -1,3 +1,3 @@ set ALLTOLUA_WAIT=N -cd ..\src +cd ..\src\Bindings AllToLua.bat \ No newline at end of file diff --git a/VC2013/GenerateBindings.cmd b/VC2013/GenerateBindings.cmd index 1ee0f3bf0..e247d7f4f 100644 --- a/VC2013/GenerateBindings.cmd +++ b/VC2013/GenerateBindings.cmd @@ -1,3 +1,3 @@ set ALLTOLUA_WAIT=N -cd ..\src +cd ..\src\Bindings AllToLua.bat \ No newline at end of file diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index 07e1ffb4a..56fbdc165 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -1,4 +1,4 @@ - + @@ -367,15 +367,15 @@ - - - - - - + + + + + + - + @@ -808,7 +808,7 @@ true true - + @@ -820,13 +820,13 @@ - - - - - - - + + + + + + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)