diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 2 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/Hooks/OnKilling.lua | 1 | ||||
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 111 | ||||
-rw-r--r-- | MCServer/Plugins/Debuggers/Info.lua | 6 | ||||
-rw-r--r-- | SetFlags.cmake | 12 | ||||
-rw-r--r-- | src/BlockEntities/FurnaceEntity.cpp | 42 | ||||
-rw-r--r-- | src/BlockEntities/FurnaceEntity.h | 8 | ||||
-rw-r--r-- | src/Globals.h | 1 | ||||
-rw-r--r-- | src/LineBlockTracer.cpp | 19 | ||||
-rw-r--r-- | src/OSSupport/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/OSSupport/Event.cpp | 4 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.cpp | 107 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.h | 17 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 12 | ||||
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 5 |
18 files changed, 197 insertions, 157 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 01158a7e5..d03690865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,7 @@ if(${BUILD_UNSTABLE_TOOLS}) add_subdirectory(Tools/GeneratorPerformanceTest/) endif() +include(CheckCXXCompilerFlag) include(SetFlags.cmake) set_flags() set_lib_flags() @@ -204,3 +205,4 @@ if (MSVC) set_target_properties(arraystocoords-exe coordinates-exe copies-exe copyblocks-exe creatable-exe EchoServer Google-exe ChunkBuffer NameLookup PROPERTIES FOLDER Tests) endif() endif() + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e57e6efb..1b43ed214 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Here are the conventions: - This helps prevent mistakes such as `if (a & 1 == 0)` * * Use the provided wrappers for OS stuff: - - Threading is done by inheriting from `cIsThread`, thread synchronization through `cCriticalSection`, `cSemaphore` and `cEvent`, file access and filesystem operations through the `cFile` class, high-precision timers through `cTimer`, high-precision sleep through `cSleep` + - Threading is done by inheriting from `cIsThread`, thread synchronization through `cCriticalSection` and `cEvent`, file access and filesystem operations through the `cFile` class, high-precision timers through `cTimer`, high-precision sleep through `cSleep` * No magic numbers, use named constants: - `E_ITEM_XXX`, `E_BLOCK_XXX` and `E_META_XXX` for items and blocks - `cEntity::etXXX` for entity types, `cMonster::mtXXX` for mob types diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b7ecd45a3..82ae6a7a8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -8,6 +8,7 @@ derouinw Diusrex Duralex FakeTruth (founder) +HaoTNN Howaner jan64 jasperarmstrong diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index f2b5d1ce8..ba3c8b332 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1917,6 +1917,8 @@ a_Player:OpenWindow(Window); SendMessagePrivateMsg = { Params = "Message, SenderName", Return = "", Notes = "Prepends Light Blue [MSG: *SenderName*] / prepends SenderName and colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For private messaging." }, SendMessageSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Success notification." }, SendMessageWarning = { Params = "Message, Sender", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Denotes that something concerning, such as plugin reload, is about to happen." }, + SendAboveActionBarMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (shows above action bar, doesn't show for < 1.8 clients)." }, + SendSystemMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (doesn't show for < 1.8 clients)." }, SendRotation = { Params = "YawDegrees, PitchDegrees", Return = "", Notes = "Sends the specified rotation to the player, forcing them to look that way" }, SetBedPos = { Params = "{{Vector3i|Position}}", Return = "", Notes = "Sets the internal representation of the last bed position the player has slept in. The player will respawn at this position if they die." }, SetCanFly = { Params = "CanFly", Notes = "Sets if the player can fly or not." }, diff --git a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua b/MCServer/Plugins/APIDump/Hooks/OnKilling.lua index 8ec1cfe2e..5e84009db 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnKilling.lua @@ -17,6 +17,7 @@ return { { Name = "Victim", Type = "{{cPawn}}", Notes = "The player or mob that is about to be killed" }, { Name = "Killer", Type = "{{cEntity}}", Notes = "The entity that has caused the victim to lose the last point of health. May be nil for environment damage" }, + { Name = "TDI", Type = "{{TakeDamageInfo}}", Notes = "The damage type, cause and effects." }, }, Returns = [[ If the function returns false or no value, MCServer calls other plugins with this event. If the diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index a49f8b5a6..bd0b94a06 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1880,6 +1880,117 @@ end +--- Returns the square of the distance from the specified point to the specified line +local function SqDistPtFromLine(x, y, x1, y1, x2, y2) + local dx = x - x1 + local dy = y - y1 + local px = x2 - x1 + local py = y2 - y1 + local ss = px * dx + py * dy + local ds = px * px + py * py + + if (ss < 0) then + -- Return sqdistance from point 1 + return dx * dx + dy * dy + end + if (ss > ds) then + -- Return sqdistance from point 2 + return ((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)) + end + + -- Return sqdistance from the line + if ((px * px + py * py) == 0) then + return dx * dx + dy * dy + else + return (py * dx - px * dy) * (py * dx - px * dy) / (px * px + py * py) + end +end + + + + + +function HandleConsoleTestTracer(a_Split, a_EntireCmd) + -- Check required params: + if not(a_Split[7]) then + return true, "Usage: " .. a_Split[1] .. " <x1> <y1> <z1> <x2> <y2> <z2> [<WorldName>]" + end + local Coords = {} + for i = 1, 6 do + local v = tonumber(a_Split[i + 1]) + if not(v) then + return true, "Parameter " .. (i + 1) .. " (" .. tostring(a_Split[i + 1]) .. ") not a number " + end + Coords[i] = v + end + + -- Get the world in which to test: + local World + if (a_Split[8]) then + World = cRoot:GetWorld(a_Split[2]) + else + World = cRoot:Get():GetDefaultWorld() + end + if not(World) then + return true, "No such world" + end + + -- Define the callbacks to use for tracing: + local Callbacks = + { + OnNextBlock = function(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_EntryFace) + LOG(string.format("{%d, %d, %d}: %s", a_BlockX, a_BlockY, a_BlockZ, ItemToString(cItem(a_BlockType, 1, a_BlockMeta)))) + end, + OnNextBlockNoData = function(a_BlockX, a_BlockY, a_BlockZ, a_EntryFace) + LOG(string.format("{%d, %d, %d} (no data)", a_BlockX, a_BlockY, a_BlockZ)) + end, + OnNoChunk = function() + LOG("Chunk not loaded") + end, + OnNoMoreHits = function() + LOG("Trace finished") + end, + OnOutOfWorld = function() + LOG("Out of world") + end, + OnIntoWorld = function() + LOG("Into world") + end, + } + + -- Approximate the chunks needed for the trace by iterating over all chunks and measuring their center's distance from the traced line + local Chunks = {} + local sx = math.floor(Coords[1] / 16) + local sz = math.floor(Coords[3] / 16) + local ex = math.floor(Coords[4] / 16) + local ez = math.floor(Coords[6] / 16) + local sgnx = (sx < ex) and 1 or -1 + local sgnz = (sz < ez) and 1 or -1 + for z = sz, ez, sgnz do + local ChunkCenterZ = z * 16 + 8 + for x = sx, ex, sgnx do + local ChunkCenterX = x * 16 + 8 + local sqdist = SqDistPtFromLine(ChunkCenterX, ChunkCenterZ, Coords[1], Coords[3], Coords[4], Coords[6]) + if (sqdist <= 128) then + table.insert(Chunks, {x, z}) + end + end + end + + -- Load the chunks and do the trace once loaded: + World:ChunkStay(Chunks, + nil, + function() + cLineBlockTracer:Trace(World, Callbacks, Coords[1], Coords[2], Coords[3], Coords[4], Coords[5], Coords[6]) + end + ) + return true +end + + + + + function HandleConsoleBBox(a_Split) local bbox = cBoundingBox(0, 10, 0, 10, 0, 10) local v1 = Vector3d(1, 1, 1) diff --git a/MCServer/Plugins/Debuggers/Info.lua b/MCServer/Plugins/Debuggers/Info.lua index 2e170487b..a76690ea1 100644 --- a/MCServer/Plugins/Debuggers/Info.lua +++ b/MCServer/Plugins/Debuggers/Info.lua @@ -235,6 +235,12 @@ g_PluginInfo = Handler = HandleConsoleSchedule, HelpString = "Tests the world scheduling", }, + + ["testtracer"] = + { + Handler = HandleConsoleTestTracer, + HelpString = "Tests the cLineBlockTracer", + } }, -- ConsoleCommands } -- g_PluginInfo diff --git a/SetFlags.cmake b/SetFlags.cmake index b79551eef..57cab5a1c 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -63,7 +63,7 @@ macro(set_flags) set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG") set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") elseif(APPLE) - + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) @@ -262,8 +262,11 @@ macro(set_exe_flags) add_flags_cxx("-Wno-documentation") endif() if ("${CLANG_VERSION}" VERSION_GREATER 3.5) - # Use this flag to ignore error for a reserved macro problem in sqlite 3 - add_flags_cxx("-Wno-reserved-id-macro") + check_cxx_compiler_flag(-Wno-reserved-id-macro HAS_NO_RESERVED_ID_MACRO) + if (HAS_NO_RESERVED_ID_MACRO) + # Use this flag to ignore error for a reserved macro problem in sqlite 3 + add_flags_cxx("-Wno-reserved-id-macro") + endif() endif() endif() endif() @@ -277,7 +280,7 @@ endmacro() # set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=missing-prototypes -Wno-error=deprecated") # set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=switch-enum -Wno-error=switch") # set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal -Wno-error=global-constructors") - + # if ("${CLANG_VERSION}" VERSION_GREATER 3.0) # # flags that are not present in 3.0 # set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=covered-switch-default ") @@ -286,4 +289,3 @@ endmacro() # endif() # endforeach() # endif() - diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp index 2621b560b..d1588160d 100644 --- a/src/BlockEntities/FurnaceEntity.cpp +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -32,7 +32,8 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY m_NeedCookTime(0), m_TimeCooked(0), m_FuelBurnTime(0), - m_TimeBurned(0) + m_TimeBurned(0), + m_IsLoading(false) { m_Contents.AddListener(*this); } @@ -178,20 +179,15 @@ void cFurnaceEntity::BurnNewFuel(void) { cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); int NewTime = FR->GetBurnTime(m_Contents.GetSlot(fsFuel)); - if (NewTime == 0) + if ((NewTime == 0) || !CanCookInputToOutput()) { // The item in the fuel slot is not suitable + // or the input and output isn't available for cooking SetBurnTimes(0, 0); SetIsCooking(false); return; } - // Is the input and output ready for cooking? - if (!CanCookInputToOutput()) - { - return; - } - // Burn one new fuel: SetBurnTimes(NewTime, 0); SetIsCooking(true); @@ -218,6 +214,11 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) return; } + if (m_IsLoading) + { + return; + } + ASSERT(a_ItemGrid == &m_Contents); switch (a_SlotNum) { @@ -238,7 +239,10 @@ void cFurnaceEntity::UpdateInput(void) if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput)) { // The input is different from what we had before, reset the cooking time - m_TimeCooked = 0; + if (!m_IsLoading) + { + m_TimeCooked = 0; + } } m_LastInput = m_Contents.GetSlot(fsInput); @@ -253,13 +257,17 @@ void cFurnaceEntity::UpdateInput(void) else { m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(true); // Start burning new fuel if there's no flame now: if (GetFuelBurnTimeLeft() <= 0) { BurnNewFuel(); } + // Already burning, set cooking to ensure that cooking is occuring + else + { + SetIsCooking(true); + } } } @@ -293,11 +301,19 @@ void cFurnaceEntity::UpdateOutput(void) return; } - // No need to burn new fuel, the Tick() function will take care of that - // Can cook, start cooking if not already underway: m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(m_FuelBurnTime > 0); + + // Check if fuel needs to start a burn + if (GetFuelBurnTimeLeft() <= 0) + { + BurnNewFuel(); + } + // Already burning, set cooking to ensure that cooking is occuring + else + { + SetIsCooking(true); + } } diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h index 8b3ba3e36..8734d763c 100644 --- a/src/BlockEntities/FurnaceEntity.h +++ b/src/BlockEntities/FurnaceEntity.h @@ -101,6 +101,11 @@ public: m_TimeCooked = a_TimeCooked; } + void SetLoading(bool a_IsLoading) + { + m_IsLoading = a_IsLoading; + } + protected: /** Block meta of the block currently represented by this entity */ @@ -129,6 +134,9 @@ protected: /** Amount of ticks that the current fuel has been burning */ int m_TimeBurned; + + /** Is the block currently being loaded into the world? */ + bool m_IsLoading; /** Sends the specified progressbar value to all clients of the window */ void BroadcastProgress(short a_ProgressbarID, short a_Value); diff --git a/src/Globals.h b/src/Globals.h index 27d944fcc..e7b7fdcac 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -265,7 +265,6 @@ template class SizeChecker<UInt8, 1>; // Common headers (part 1, without macros): #include "StringUtils.h" #include "OSSupport/CriticalSection.h" - #include "OSSupport/Semaphore.h" #include "OSSupport/Event.h" #include "OSSupport/File.h" #include "Logger.h" diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp index 315e8d082..587fa0e7c 100644 --- a/src/LineBlockTracer.cpp +++ b/src/LineBlockTracer.cpp @@ -154,38 +154,45 @@ bool cLineBlockTracer::MoveToNextBlock(void) { // Find out which of the current block's walls gets hit by the path: static const double EPS = 0.00001; - double Coeff = 1; - enum eDirection + enum { dirNONE, dirX, dirY, dirZ, } Direction = dirNONE; + + // Calculate the next YZ wall hit: + double Coeff = 1; if (std::abs(m_DiffX) > EPS) { double DestX = (m_DirX > 0) ? (m_CurrentX + 1) : m_CurrentX; - Coeff = (DestX - m_StartX) / m_DiffX; - if (Coeff <= 1) + double CoeffX = (DestX - m_StartX) / m_DiffX; + if (CoeffX <= 1) // We need to include equality for the last block in the trace { + Coeff = CoeffX; Direction = dirX; } } + + // If the next XZ wall hit is closer, use it instead: if (std::abs(m_DiffY) > EPS) { double DestY = (m_DirY > 0) ? (m_CurrentY + 1) : m_CurrentY; double CoeffY = (DestY - m_StartY) / m_DiffY; - if (CoeffY < Coeff) + if (CoeffY <= Coeff) // We need to include equality for the last block in the trace { Coeff = CoeffY; Direction = dirY; } } + + // If the next XY wall hit is closer, use it instead: if (std::abs(m_DiffZ) > EPS) { double DestZ = (m_DirZ > 0) ? (m_CurrentZ + 1) : m_CurrentZ; double CoeffZ = (DestZ - m_StartZ) / m_DiffZ; - if (CoeffZ < Coeff) + if (CoeffZ <= Coeff) // We need to include equality for the last block in the trace { Direction = dirZ; } diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt index d1db0373d..df47394ae 100644 --- a/src/OSSupport/CMakeLists.txt +++ b/src/OSSupport/CMakeLists.txt @@ -15,7 +15,6 @@ SET (SRCS IsThread.cpp NetworkInterfaceEnum.cpp NetworkSingleton.cpp - Semaphore.cpp ServerHandleImpl.cpp StackTrace.cpp TCPLinkImpl.cpp @@ -34,7 +33,6 @@ SET (HDRS Network.h NetworkSingleton.h Queue.h - Semaphore.h ServerHandleImpl.h StackTrace.h TCPLinkImpl.h diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index 760e536a1..38144ead3 100644 --- a/src/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp @@ -1,8 +1,8 @@ // Event.cpp -// Implements the cEvent object representing an OS-specific synchronization primitive that can be waited-for -// Implemented as an Event on Win and as a 1-semaphore on *nix +// Interfaces to the cEvent object representing a synchronization primitive that can be waited-for +// Implemented using C++11 condition variable and mutex #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules diff --git a/src/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp deleted file mode 100644 index 6a2d57901..000000000 --- a/src/OSSupport/Semaphore.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - - - - - -cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */) -#ifndef _WIN32 - : m_bNamed( false) -#endif -{ -#ifndef _WIN32 - (void)a_MaxCount; - m_Handle = new sem_t; - if (sem_init( (sem_t*)m_Handle, 0, 0)) - { - LOG("WARNING cSemaphore: Could not create unnamed semaphore, fallback to named."); - delete (sem_t*)m_Handle; // named semaphores return their own address - m_bNamed = true; - - AString Name; - Printf(Name, "cSemaphore%p", this); - m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount); - if (m_Handle == SEM_FAILED) - { - LOG("ERROR: Could not create Semaphore. (%i)", errno); - } - else - { - if (sem_unlink(Name.c_str()) != 0) - { - LOG("ERROR: Could not unlink cSemaphore. (%i)", errno); - } - } - } -#else - m_Handle = CreateSemaphore( - nullptr, // security attribute - a_InitialCount, // initial count - a_MaxCount, // maximum count - 0 // name (optional) - ); -#endif -} - - - - - -cSemaphore::~cSemaphore() -{ -#ifdef _WIN32 - CloseHandle( m_Handle); -#else - if (m_bNamed) - { - if (sem_close( (sem_t*)m_Handle) != 0) - { - LOG("ERROR: Could not close cSemaphore. (%i)", errno); - } - } - else - { - sem_destroy( (sem_t*)m_Handle); - delete (sem_t*)m_Handle; - } - m_Handle = 0; - -#endif -} - - - - - -void cSemaphore::Wait() -{ -#ifndef _WIN32 - if (sem_wait( (sem_t*)m_Handle) != 0) - { - LOG("ERROR: Could not wait for cSemaphore. (%i)", errno); - } -#else - WaitForSingleObject( m_Handle, INFINITE); -#endif -} - - - - - -void cSemaphore::Signal() -{ -#ifndef _WIN32 - if (sem_post( (sem_t*)m_Handle) != 0) - { - LOG("ERROR: Could not signal cSemaphore. (%i)", errno); - } -#else - ReleaseSemaphore( m_Handle, 1, nullptr); -#endif -} - - - - diff --git a/src/OSSupport/Semaphore.h b/src/OSSupport/Semaphore.h deleted file mode 100644 index 57fa4bdb2..000000000 --- a/src/OSSupport/Semaphore.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -class cSemaphore -{ -public: - cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount = 0); - ~cSemaphore(); - - void Wait(); - void Signal(); -private: - void * m_Handle; // HANDLE pointer - -#ifndef _WIN32 - bool m_bNamed; -#endif -}; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 71c68c071..e043698dd 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -302,7 +302,12 @@ void cProtocol172::SendChatAboveActionBar(const cCompositeChat & a_Message) void cProtocol172::SendChatType(const AString & a_Message, eChatType type) { ASSERT(m_State == 3); // In game mode? - + + if (type != ctChatBox) // 1.7.2 doesn't support anything else + { + return; + } + cPacketizer Pkt(*this, 0x02); // Chat Message packet Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str())); } @@ -315,6 +320,11 @@ void cProtocol172::SendChatType(const cCompositeChat & a_Message, eChatType type { ASSERT(m_State == 3); // In game mode? + if (type != ctChatBox) // 1.7.2 doesn't support anything else + { + return; + } + cWorld * World = m_Client->GetPlayer()->GetWorld(); bool ShouldUseChatPrefixes = (World == nullptr) ? false : World->ShouldUseChatPrefixes(); diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 392b9bf83..8ca49c2c0 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -1052,7 +1052,8 @@ cBlockEntity * cWSSAnvil::LoadFurnaceFromNBT(const cParsedNBT & a_NBT, int a_Tag } std::unique_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, m_World)); - + Furnace->SetLoading(true); + // Load slots: for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) { @@ -1085,9 +1086,9 @@ cBlockEntity * cWSSAnvil::LoadFurnaceFromNBT(const cParsedNBT & a_NBT, int a_Tag // Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds (200 ticks) Furnace->SetCookTimes(200, ct); } - // Restart cooking: Furnace->ContinueCooking(); + Furnace->SetLoading(false); return Furnace.release(); } |