Merge branch 'master' into PreventNewWarnings
Conflicts: src/Inventory.cpp
This commit is contained in:
commit
e19693e529
@ -18,6 +18,7 @@ Masy98
|
||||
mborland
|
||||
mgueydan
|
||||
MikeHunsinger
|
||||
missingchar (mathias-github)
|
||||
mtilden
|
||||
nesco
|
||||
p-mcgowan
|
||||
|
@ -2061,6 +2061,7 @@ a_Player:OpenWindow(Window);
|
||||
GetPrimaryServerVersion = { Params = "", Return = "number", Notes = "Returns the servers primary server version." },
|
||||
GetProtocolVersionTextFromInt = { Params = "Protocol Version", Return = "string", Notes = "Returns the Minecraft version from the given Protocol. If there is no version found, it returns 'Unknown protocol(Parameter)'" },
|
||||
GetServer = { Params = "", Return = "{{cServer|cServer}}", Notes = "Returns the cServer object." },
|
||||
GetServerUpTime = { Params = "", Return = "number", Notes = "Returns the uptime of the server in seconds." },
|
||||
GetTotalChunkCount = { Params = "", Return = "number", Notes = "Returns the amount of loaded chunks." },
|
||||
GetVirtualRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of virtual RAM that the entire MCServer process is using, in KiB. Negative if the OS doesn't support this query." },
|
||||
GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." },
|
||||
@ -3020,7 +3021,3 @@ end
|
||||
{ FileName = "WebWorldThreads.html", Title = "Webserver vs World threads" },
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -322,7 +322,7 @@ MushroomStew = Bowl, * | BrownMushroom, * | RedMushroom, *
|
||||
Bread = Wheat, 1:1, 2:1, 3:1
|
||||
Sugar = Sugarcane, *
|
||||
Cake = MilkBucket, 1:1, 2:1, 3:1 | Sugar, 1:2, 3:2 | Egg, 2:2 | Wheat, 1:3, 2:3, 3:3
|
||||
Cookie = Wheat, *, * | CocoaBeans, *
|
||||
Cookie, 8 = Wheat, *, * | CocoaBeans, *
|
||||
GoldenApple = RedApple, 2:2 | GoldIngot, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
|
||||
EnchantedGoldenApple = RedApple, 2:2 | GoldBlock, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
|
||||
Melon = MelonSlice, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
|
||||
|
@ -246,6 +246,11 @@ macro(set_exe_flags)
|
||||
# we support non-IEEE 754 fpus so can make no guarentees about error
|
||||
add_flags_cxx("-ffast-math")
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
# backtrace() and friends are in libexecinfo
|
||||
add_flags_lnk("-lexecinfo")
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if ("${CLANG_VERSION}" VERSION_LESS 3.0)
|
||||
message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION}")
|
||||
|
@ -25,7 +25,7 @@ endif()
|
||||
|
||||
# FreeBSD requires us to define this to get POSIX 2001 standard
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
add_flags_cxx(-D__POSIX_VISIBLE=200112)
|
||||
add_flags_cxx("-D_XOPEN_SOURCE=600")
|
||||
endif()
|
||||
|
||||
add_library(sqlite ${SOURCE})
|
||||
|
@ -53,4 +53,8 @@ if(UNIX)
|
||||
target_link_libraries(tolua m ${DYNAMIC_LOADER})
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
add_flags_lnk(-L/usr/local/lib)
|
||||
endif()
|
||||
|
||||
target_link_libraries(tolua tolualib lua)
|
||||
|
@ -1935,7 +1935,7 @@ size_t cPluginManager::GetNumLoadedPlugins(void) const
|
||||
AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_Settings)
|
||||
{
|
||||
// Check if the Plugins section exists.
|
||||
if (a_Settings.KeyExists("Plugins"))
|
||||
if (!a_Settings.KeyExists("Plugins"))
|
||||
{
|
||||
InsertDefaultPlugins(a_Settings);
|
||||
}
|
||||
|
@ -364,4 +364,9 @@ endif ()
|
||||
if (WIN32)
|
||||
target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
add_flags_lnk(-L/usr/local/lib)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${EXECUTABLE} luaexpat jsoncpp mbedtls zlib sqlite lua SQLiteCpp event_core event_extra)
|
||||
|
@ -2329,6 +2329,15 @@ void cClientHandle::SendHealth(void)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendHideTitle(void)
|
||||
{
|
||||
m_Protocol->SendHideTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
m_Protocol->SendInventorySlot(a_WindowID, a_SlotNum, a_Item);
|
||||
@ -2532,6 +2541,15 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendResetTitle()
|
||||
{
|
||||
m_Protocol->SendResetTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
|
||||
{
|
||||
m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks);
|
||||
@ -2586,6 +2604,42 @@ void cClientHandle::SendDisplayObjective(const AString & a_Objective, cScoreboar
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSetSubTitle(const cCompositeChat & a_SubTitle)
|
||||
{
|
||||
m_Protocol->SendSetSubTitle(a_SubTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSetRawSubTitle(const AString & a_SubTitle)
|
||||
{
|
||||
m_Protocol->SendSetRawSubTitle(a_SubTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSetTitle(const cCompositeChat & a_Title)
|
||||
{
|
||||
m_Protocol->SendSetTitle(a_Title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSetRawTitle(const AString & a_Title)
|
||||
{
|
||||
m_Protocol->SendSetRawTitle(a_Title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
|
||||
{
|
||||
m_Protocol->SendSoundEffect(a_SoundName, a_X, a_Y, a_Z, a_Volume, a_Pitch);
|
||||
@ -2676,6 +2730,15 @@ void cClientHandle::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
|
||||
{
|
||||
m_Protocol->SendTitleTimes(a_FadeInTicks, a_DisplayTicks, a_FadeOutTicks);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
|
||||
{
|
||||
m_Protocol->SendTimeUpdate(a_WorldAge, a_TimeOfDay, a_DoDaylightCycle);
|
||||
@ -2900,7 +2963,14 @@ void cClientHandle::SocketClosed(void)
|
||||
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
|
||||
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
|
||||
}
|
||||
|
||||
if (m_State < csDestroying)
|
||||
{
|
||||
cWorld * World = m_Player->GetWorld();
|
||||
if (World != nullptr)
|
||||
{
|
||||
World->RemovePlayer(m_Player, true); // Must be called before cPlayer::Destroy() as otherwise cChunk tries to delete the player, and then we do it again
|
||||
}
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,7 @@ public: // tolua_export
|
||||
void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion);
|
||||
void SendGameMode (eGameMode a_GameMode);
|
||||
void SendHealth (void);
|
||||
void SendHideTitle (void);
|
||||
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
|
||||
void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale);
|
||||
void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale);
|
||||
@ -192,9 +193,14 @@ public: // tolua_export
|
||||
void SendPlayerSpawn (const cPlayer & a_Player);
|
||||
void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp
|
||||
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
|
||||
void SendResetTitle (void);
|
||||
void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false);
|
||||
void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
|
||||
void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
|
||||
void SendSetSubTitle (const cCompositeChat & a_SubTitle);
|
||||
void SendSetRawSubTitle (const AString & a_SubTitle);
|
||||
void SendSetTitle (const cCompositeChat & a_Title);
|
||||
void SendSetRawTitle (const AString & a_Title);
|
||||
void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export
|
||||
void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data);
|
||||
void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock);
|
||||
@ -205,6 +211,7 @@ public: // tolua_export
|
||||
void SendTabCompletionResults (const AStringVector & a_Results);
|
||||
void SendTeleportEntity (const cEntity & a_Entity);
|
||||
void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks);
|
||||
void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle); // tolua_export
|
||||
void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
|
||||
void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);
|
||||
|
@ -228,6 +228,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
|
||||
|
||||
m_Item.m_ItemCount -= NumAdded;
|
||||
m_World->BroadcastCollectEntity(*this, a_Dest);
|
||||
|
||||
// Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;)
|
||||
m_World->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
|
||||
if (m_Item.m_ItemCount <= 0)
|
||||
|
@ -98,7 +98,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
|
||||
|
||||
|
||||
|
||||
int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
|
||||
int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks)
|
||||
{
|
||||
cItem ToAdd(a_Item);
|
||||
int res = 0;
|
||||
@ -116,8 +116,29 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
|
||||
}
|
||||
}
|
||||
|
||||
res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1);
|
||||
ToAdd.m_ItemCount = a_Item.m_ItemCount - static_cast<char>(res);
|
||||
for (int SlotIdx = 0; SlotIdx < m_InventorySlots.GetNumSlots(); ++SlotIdx)
|
||||
{
|
||||
auto & Slot = m_InventorySlots.GetSlot(SlotIdx);
|
||||
if (Slot.IsEqual(a_Item))
|
||||
{
|
||||
cItemHandler Handler(Slot.m_ItemType);
|
||||
int AmountToAdd = std::min(static_cast<char>(Handler.GetMaxStackSize() - Slot.m_ItemCount), ToAdd.m_ItemCount);
|
||||
res += AmountToAdd;
|
||||
|
||||
cItem SlotAdjusted(Slot);
|
||||
SlotAdjusted.m_ItemCount += AmountToAdd;
|
||||
m_InventorySlots.SetSlot(SlotIdx, SlotAdjusted);
|
||||
|
||||
ToAdd.m_ItemCount -= AmountToAdd;
|
||||
if (ToAdd.m_ItemCount == 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks);
|
||||
ToAdd.m_ItemCount = a_Item.m_ItemCount - res;
|
||||
if (ToAdd.m_ItemCount == 0)
|
||||
{
|
||||
return res;
|
||||
@ -131,12 +152,12 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
|
||||
|
||||
|
||||
|
||||
int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
|
||||
int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks)
|
||||
{
|
||||
int TotalAdded = 0;
|
||||
for (cItems::iterator itr = a_ItemStackList.begin(); itr != a_ItemStackList.end();)
|
||||
{
|
||||
int NumAdded = AddItem(*itr, a_AllowNewStacks, a_tryToFillEquippedFirst);
|
||||
int NumAdded = AddItem(*itr, a_AllowNewStacks);
|
||||
if (itr->m_ItemCount == NumAdded)
|
||||
{
|
||||
itr = a_ItemStackList.erase(itr);
|
||||
|
@ -70,23 +70,17 @@ public:
|
||||
/** Adds as many items out of a_ItemStack as can fit.
|
||||
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
|
||||
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
|
||||
If a_tryToFillEquippedFirst is set to true, the currently equipped slot will be used first (if empty or
|
||||
compatible with added items)
|
||||
if a_tryToFillEquippedFirst is set to false, the regular order applies.
|
||||
Returns the number of items that fit.
|
||||
*/
|
||||
int AddItem(const cItem & a_ItemStack, bool a_AllowNewStacks = true, bool a_tryToFillEquippedFirst = false);
|
||||
int AddItem(const cItem & a_ItemStack, bool a_AllowNewStacks = true);
|
||||
|
||||
/** Same as AddItem, but works on an entire list of item stacks.
|
||||
The a_ItemStackList is modified to reflect the leftover items.
|
||||
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
|
||||
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
|
||||
If a_tryToFillEquippedFirst is set to true, the currently equipped slot will be used first (if empty or
|
||||
compatible with added items)
|
||||
if a_tryToFillEquippedFirst is set to false, the regular order applies.
|
||||
Returns the total number of items that fit.
|
||||
*/
|
||||
int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst);
|
||||
int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks);
|
||||
|
||||
/** Removes the specified item from the inventory, as many as possible, up to a_ItemStack.m_ItemCount.
|
||||
Returns the number of items that were removed. */
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
ASSERT(!"Inventory bucket mismatch");
|
||||
return true;
|
||||
}
|
||||
if (a_Player->GetInventory().AddItem(cItem(NewItem), true, true) != 1)
|
||||
if (a_Player->GetInventory().AddItem(cItem(NewItem)) != 1)
|
||||
{
|
||||
// The bucket didn't fit, toss it as a pickup:
|
||||
a_Player->TossPickup(cItem(NewItem));
|
||||
@ -151,7 +151,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
cItem Item(E_ITEM_BUCKET, 1);
|
||||
if (!a_Player->GetInventory().AddItem(Item, true, true))
|
||||
if (!a_Player->GetInventory().AddItem(Item))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)), true, true);
|
||||
a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
// Return a bowl to the inventory
|
||||
if (!a_Player->IsGameModeCreative())
|
||||
{
|
||||
a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL), true, true);
|
||||
a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -195,8 +195,16 @@ bool cMonster::TickPathFinding(cChunk & a_Chunk)
|
||||
case ePathFinderStatus::PATH_FOUND:
|
||||
{
|
||||
if (m_NoMoreWayPoints || (--m_GiveUpCounter == 0))
|
||||
{
|
||||
if (m_EMState == ATTACKING)
|
||||
{
|
||||
ResetPathFinding(); // Try to calculate a path again.
|
||||
// This results in mobs hanging around an unreachable target (player).
|
||||
}
|
||||
else
|
||||
{
|
||||
StopMovingToPosition(); // Find a different place to go to.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (!m_Path->IsLastPoint()) // Have we arrived at the next cell, as denoted by m_NextWayPointPosition?
|
||||
@ -391,6 +399,7 @@ void cMonster::MoveToPosition(const Vector3d & a_Position)
|
||||
void cMonster::StopMovingToPosition()
|
||||
{
|
||||
m_IsFollowingPath = false;
|
||||
ResetPathFinding();
|
||||
}
|
||||
|
||||
|
||||
@ -520,7 +529,7 @@ void cMonster::SetPitchAndYawFromDestination()
|
||||
double HeadRotation, HeadPitch;
|
||||
Distance.Normalize();
|
||||
VectorToEuler(Distance.x, Distance.y, Distance.z, HeadRotation, HeadPitch);
|
||||
if (std::abs(BodyRotation - HeadRotation) < 120)
|
||||
if (std::abs(BodyRotation - HeadRotation) < 90)
|
||||
{
|
||||
SetHeadYaw(HeadRotation);
|
||||
SetPitch(-HeadPitch);
|
||||
|
@ -20,6 +20,7 @@ cWolf::cWolf(void) :
|
||||
m_OwnerName(""),
|
||||
m_CollarColor(14)
|
||||
{
|
||||
m_RelativeWalkSpeed = 2;
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +231,7 @@ void cWolf::TickFollowPlayer()
|
||||
{
|
||||
// The player is present in the world, follow him:
|
||||
double Distance = (Callback.OwnerPos - GetPosition()).Length();
|
||||
if (Distance > 30)
|
||||
if (Distance > 20)
|
||||
{
|
||||
Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
|
||||
TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
|
||||
|
@ -22,7 +22,7 @@ AString GetOSErrorString( int a_ErrNo)
|
||||
|
||||
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
|
||||
|
||||
#if !defined(__APPLE__) && ( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
|
||||
#if !defined(__APPLE__) && defined( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
|
||||
|
||||
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
|
||||
if (res != nullptr)
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
|
||||
virtual void SendGameMode (eGameMode a_GameMode) = 0;
|
||||
virtual void SendHealth (void) = 0;
|
||||
virtual void SendHideTitle (void) = 0;
|
||||
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
|
||||
virtual void SendKeepAlive (int a_PingID) = 0;
|
||||
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
|
||||
@ -112,12 +113,17 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
|
||||
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) = 0;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0;
|
||||
virtual void SendResetTitle (void) = 0;
|
||||
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) = 0;
|
||||
virtual void SendExperience (void) = 0;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0;
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) = 0;
|
||||
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) = 0;
|
||||
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) = 0;
|
||||
virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) = 0;
|
||||
virtual void SendSetRawSubTitle (const AString & a_SubTitle) = 0;
|
||||
virtual void SendSetTitle (const cCompositeChat & a_Title) = 0;
|
||||
virtual void SendSetRawTitle (const AString & a_Title) = 0;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) = 0;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
|
||||
@ -128,6 +134,7 @@ public:
|
||||
virtual void SendTabCompletionResults (const AStringVector & a_Results) = 0;
|
||||
virtual void SendTeleportEntity (const cEntity & a_Entity) = 0;
|
||||
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
|
||||
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) = 0;
|
||||
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) = 0;
|
||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
|
||||
|
@ -555,6 +555,15 @@ void cProtocol172::SendHealth(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendHideTitle(void)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
@ -995,6 +1004,15 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendResetTitle(void)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
|
||||
{
|
||||
if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
|
||||
@ -1094,6 +1112,42 @@ void cProtocol172::SendDisplayObjective(const AString & a_Objective, cScoreboard
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSetSubTitle(const cCompositeChat & a_SubTitle)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSetRawSubTitle(const AString & a_SubTitle)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSetTitle(const cCompositeChat & a_Title)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSetRawTitle(const AString & a_Title)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
@ -1296,6 +1350,15 @@ void cProtocol172::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
|
||||
virtual void SendGameMode (eGameMode a_GameMode) override;
|
||||
virtual void SendHealth (void) override;
|
||||
virtual void SendHideTitle (void) override;
|
||||
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendKeepAlive (int a_PingID) override;
|
||||
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
|
||||
@ -113,9 +114,14 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendResetTitle (void) override;
|
||||
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
|
||||
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
||||
virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
|
||||
virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
|
||||
virtual void SendSetTitle (const cCompositeChat & a_Title) override;
|
||||
virtual void SendSetRawTitle (const AString & a_Title) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
@ -126,6 +132,7 @@ public:
|
||||
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
|
||||
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
|
||||
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
|
||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
||||
|
@ -542,6 +542,18 @@ void cProtocol180::SendHealth(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendHideTitle(void)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x45); // Title packet
|
||||
Pkt.WriteVarInt32(3); // Hide title
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
@ -1065,6 +1077,18 @@ void cProtocol180::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendResetTitle(void)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x45); // Title packet
|
||||
Pkt.WriteVarInt32(4); // Reset title
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
|
||||
{
|
||||
if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
|
||||
@ -1167,6 +1191,52 @@ void cProtocol180::SendDisplayObjective(const AString & a_Objective, cScoreboard
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendSetSubTitle(const cCompositeChat & a_SubTitle)
|
||||
{
|
||||
SendSetRawSubTitle(a_SubTitle.CreateJsonString(false));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendSetRawSubTitle(const AString & a_SubTitle)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x45); // Title packet
|
||||
Pkt.WriteVarInt32(1); // Set subtitle
|
||||
|
||||
Pkt.WriteString(a_SubTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendSetTitle(const cCompositeChat & a_Title)
|
||||
{
|
||||
SendSetRawTitle(a_Title.CreateJsonString(false));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendSetRawTitle(const AString & a_Title)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x45); // Title packet
|
||||
Pkt.WriteVarInt32(0); // Set title
|
||||
|
||||
Pkt.WriteString(a_Title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
@ -1374,6 +1444,22 @@ void cProtocol180::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x45); // Title packet
|
||||
Pkt.WriteVarInt32(2); // Set title display times
|
||||
|
||||
Pkt.WriteBEInt32(a_FadeInTicks);
|
||||
Pkt.WriteBEInt32(a_DisplayTicks);
|
||||
Pkt.WriteBEInt32(a_FadeOutTicks);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
|
||||
virtual void SendGameMode (eGameMode a_GameMode) override;
|
||||
virtual void SendHealth (void) override;
|
||||
virtual void SendHideTitle (void) override;
|
||||
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendKeepAlive (int a_PingID) override;
|
||||
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
|
||||
@ -109,6 +110,7 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendResetTitle (void) override;
|
||||
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
|
||||
virtual void SendExperience (void) override;
|
||||
@ -116,6 +118,10 @@ public:
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
||||
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
||||
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
|
||||
virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
|
||||
virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
|
||||
virtual void SendSetTitle (const cCompositeChat & a_Title) override;
|
||||
virtual void SendSetRawTitle (const AString & a_Title) override;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
virtual void SendSpawnMob (const cMonster & a_Mob) override;
|
||||
@ -125,6 +131,7 @@ public:
|
||||
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
|
||||
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
|
||||
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
|
||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
||||
|
@ -350,6 +350,16 @@ void cProtocolRecognizer::SendHealth(void)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendHideTitle(void)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendHideTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
@ -599,6 +609,16 @@ void cProtocolRecognizer::SendRemoveEntityEffect(const cEntity & a_Entity, int a
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendResetTitle(void)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendResetTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
@ -659,6 +679,46 @@ void cProtocolRecognizer::SendDisplayObjective(const AString & a_Objective, cSco
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSetSubTitle(const cCompositeChat & a_SubTitle)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendSetSubTitle(a_SubTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSetRawSubTitle(const AString & a_SubTitle)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendSetRawSubTitle(a_SubTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSetTitle(const cCompositeChat & a_Title)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendSetTitle(a_Title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSetRawTitle(const AString & a_Title)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendSetRawTitle(a_Title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
@ -759,6 +819,16 @@ void cProtocolRecognizer::SendThunderbolt(int a_BlockX, int a_BlockY, int a_Bloc
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendTitleTimes(a_FadeInTicks, a_DisplayTicks, a_FadeOutTicks);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
|
||||
virtual void SendGameMode (eGameMode a_GameMode) override;
|
||||
virtual void SendHealth (void) override;
|
||||
virtual void SendHideTitle (void) override;
|
||||
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendKeepAlive (int a_PingID) override;
|
||||
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
|
||||
@ -97,12 +98,17 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendResetTitle (void) override;
|
||||
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
||||
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
||||
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
|
||||
virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
|
||||
virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
|
||||
virtual void SendSetTitle (const cCompositeChat & a_Title) override;
|
||||
virtual void SendSetRawTitle (const AString & a_Title) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
@ -113,6 +119,7 @@ public:
|
||||
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
|
||||
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
|
||||
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
|
||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
||||
|
@ -207,6 +207,10 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo)
|
||||
#endif
|
||||
|
||||
LOG("Startup complete, took %ldms!", static_cast<long int>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - BeginTime).count()));
|
||||
|
||||
// Save the current time
|
||||
m_StartTime = std::chrono::steady_clock::now();
|
||||
|
||||
#ifdef _WIN32
|
||||
EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
|
||||
#endif
|
||||
@ -850,7 +854,3 @@ int cRoot::GetFurnaceFuelBurnTime(const cItem & a_Fuel)
|
||||
cFurnaceRecipe * FR = Get()->GetFurnaceRecipe();
|
||||
return FR->GetBurnTime(a_Fuel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
13
src/Root.h
13
src/Root.h
@ -70,6 +70,12 @@ public:
|
||||
a_OverworldName should be set for non-overworld dimensions if one wishes that world to link back to an overworld via portals
|
||||
*/
|
||||
cWorld * CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_OverworldName = "");
|
||||
|
||||
/** Returns the up time of the server in seconds */
|
||||
int GetServerUpTime(void)
|
||||
{
|
||||
return static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - m_StartTime).count());
|
||||
}
|
||||
// tolua_end
|
||||
|
||||
/// Calls the callback for each world; returns true if the callback didn't abort (return true)
|
||||
@ -86,6 +92,9 @@ public:
|
||||
/// Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel
|
||||
static int GetFurnaceFuelBurnTime(const cItem & a_Fuel); // tolua_export
|
||||
|
||||
/** The current time where the startup of the server has been completed */
|
||||
std::chrono::steady_clock::time_point m_StartTime;
|
||||
|
||||
cWebAdmin * GetWebAdmin (void) { return m_WebAdmin; } // tolua_export
|
||||
cPluginManager * GetPluginManager (void) { return m_PluginManager; } // tolua_export
|
||||
cAuthenticator & GetAuthenticator (void) { return m_Authenticator; }
|
||||
@ -223,7 +232,3 @@ private:
|
||||
|
||||
static void InputThread(cRoot & a_Params);
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1394,7 +1394,7 @@ void cSlotAreaBeacon::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
|
||||
// cSlotAreaEnchanting:
|
||||
|
||||
cSlotAreaEnchanting::cSlotAreaEnchanting(cWindow & a_ParentWindow, int a_BlockX, int a_BlockY, int a_BlockZ) :
|
||||
cSlotAreaTemporary(1, a_ParentWindow),
|
||||
cSlotAreaTemporary(2, a_ParentWindow),
|
||||
m_BlockX(a_BlockX),
|
||||
m_BlockY(a_BlockY),
|
||||
m_BlockZ(a_BlockZ)
|
||||
@ -2154,7 +2154,7 @@ bool cSlotAreaArmor::CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
switch (a_SlotNum)
|
||||
{
|
||||
case 0: return ItemCategory::IsHelmet (a_Item.m_ItemType);
|
||||
case 0: return (ItemCategory::IsHelmet(a_Item.m_ItemType) || (a_Item.m_ItemType == E_BLOCK_PUMPKIN));
|
||||
case 1: return ItemCategory::IsChestPlate(a_Item.m_ItemType);
|
||||
case 2: return ItemCategory::IsLeggings(a_Item.m_ItemType);
|
||||
case 3: return ItemCategory::IsBoots(a_Item.m_ItemType);
|
||||
|
@ -92,9 +92,9 @@ const AString cWindow::GetWindowTypeName(void) const
|
||||
int cWindow::GetNumSlots(void) const
|
||||
{
|
||||
int res = 0;
|
||||
for (cSlotAreas::const_iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
|
||||
for (const auto & itr : m_SlotAreas)
|
||||
{
|
||||
res += (*itr)->GetNumSlots();
|
||||
res += itr->GetNumSlots();
|
||||
} // for itr - m_SlotAreas[]
|
||||
return res;
|
||||
}
|
||||
@ -261,16 +261,14 @@ void cWindow::Clicked(
|
||||
}
|
||||
|
||||
int LocalSlotNum = a_SlotNum;
|
||||
int idx = 0;
|
||||
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
|
||||
for (const auto & itr : m_SlotAreas)
|
||||
{
|
||||
if (LocalSlotNum < (*itr)->GetNumSlots())
|
||||
if (LocalSlotNum < itr->GetNumSlots())
|
||||
{
|
||||
(*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
|
||||
itr->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
|
||||
return;
|
||||
}
|
||||
LocalSlotNum -= (*itr)->GetNumSlots();
|
||||
idx++;
|
||||
LocalSlotNum -= itr->GetNumSlots();
|
||||
}
|
||||
|
||||
LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.",
|
||||
|
Loading…
Reference in New Issue
Block a user