Starting a blank screen GUI when sleeping to avoid bugs

This commit is contained in:
acth2 2026-03-06 20:23:28 +01:00
parent 0404a97257
commit 2dbb5eea02

View file

@ -43,6 +43,12 @@
#include "..\Minecraft.Client\HumanoidModel.h" #include "..\Minecraft.Client\HumanoidModel.h"
#include "SoundTypes.h" #include "SoundTypes.h"
#include "..\Minecraft.Client\Minecraft.h"
#include "..\Minecraft.Client\Screen.h"
#ifdef _WINDOWS64
#include "..\Minecraft.Client\Windows64\KeyboardMouseInput.h"
#endif
void Player::_init() void Player::_init()
@ -362,6 +368,13 @@ void Player::tick()
foodData.tick(dynamic_pointer_cast<Player>(shared_from_this())); foodData.tick(dynamic_pointer_cast<Player>(shared_from_this()));
} }
#ifdef _WINDOWS64
if (g_KBMInput.IsKeyDown(VK_LSHIFT) && this->isSleeping())
{
stopSleepInBed(true, true, false);
}
#endif
// 4J Stu Debugging // 4J Stu Debugging
if (!level->isClientSide) if (!level->isClientSide)
{ {
@ -1852,6 +1865,11 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes
setPos(x + .5f, y + 15.0f / 16.0f, z + .5f); setPos(x + .5f, y + 15.0f / 16.0f, z + .5f);
} }
m_isSleeping = true; m_isSleeping = true;
#ifdef _WINDOWS64
Minecraft::GetInstance()->setScreen(new Screen());
#endif
sleepCounter = 0; sleepCounter = 0;
bedPosition = new Pos(x, y, z); bedPosition = new Pos(x, y, z);
xd = zd = yd = 0; xd = zd = yd = 0;
@ -1938,6 +1956,10 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save
{ {
setRespawnPosition(bedPosition, false); setRespawnPosition(bedPosition, false);
} }
#ifdef _WINDOWS64
Minecraft::GetInstance()->setScreen(nullptr);
#endif
} }