diff --git a/4J.Render/4J_Render.cpp b/4J.Render/4J_Render.cpp index 571a3d171..351532d4f 100644 --- a/4J.Render/4J_Render.cpp +++ b/4J.Render/4J_Render.cpp @@ -94,8 +94,8 @@ void C4JRender::Initialise() } glfwMakeContextCurrent(s_window); - glfwSwapInterval(0); // vsync - + glfwSwapInterval(1); // vsync + // Keep viewport in sync with OS-driven window resizes. glfwSetFramebufferSizeCallback(s_window, onFramebufferResize); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 5268792f2..9c4974493 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -631,7 +631,7 @@ void CMinecraftApp::InitGameSettings() // 4J-PB - don't cause an options write to happen here SetDefaultOptions(pProfileSettings,i,false); #else - // Linux (and any other platform): profile data is zero-initialised, so explicitly apply defaults + // 4jcrqaft: Linux (and any other platform): profile data is zero-initialised, so explicitly apply defaults C_4JProfile::PROFILESETTINGS *pProfileSettings=ProfileManager.GetDashboardProfileSettings(i); memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS)); SetDefaultOptions(pProfileSettings,i); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp index d630d139a..bdefd3748 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp @@ -311,6 +311,8 @@ void ItemInHandRenderer::renderItem3D(Tesselator *t, float u0, float v0, float u void ItemInHandRenderer::render(float a) { + // 4jcraft: null checks here fix player hand rendering on linux + // TOOD: determine why these are null in the first place if (!mc->player || !mc->level) return; float h = oHeight + (height - oHeight) * a; diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 3a135655b..9335fee5b 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -777,14 +777,14 @@ void GameRenderer::renderItemInHand(float a, int eye) { if (!mc->options->hideGui && !mc->gameMode->isCutScene()) { - //turnOnLightLayer(a); // disable light layer on handrenderer similarly to how it was done on the chunk render (this makes the hand look proper) + //turnOnLightLayer(a); // 4jcraft: disable light layer on handrenderer similarly to how it was done on the chunk render (this makes the hand look proper) PIXBeginNamedEvent(0,"Item in hand render"); - // add null pointer check to itemInHandRenderer to prevent a occasional seg fault + // 4jcraft: add null pointer check to itemInHandRenderer to prevent a occasional seg fault if (itemInHandRenderer != nullptr) { itemInHandRenderer->render(a); } PIXEndNamedEvent(); - //turnOffLightLayer(a); // disable light layer on handrenderer similarly to how it was done on the chunk render (this makes the hand look proper) + //turnOffLightLayer(a); // 4jcraft: disable light layer on handrenderer similarly to how it was done on the chunk render (this makes the hand look proper) } } glPopMatrix(); @@ -792,7 +792,7 @@ void GameRenderer::renderItemInHand(float a, int eye) //if (!mc->options->thirdPersonView && !mc->cameraTargetPlayer->isSleeping()) if (!localplayer->ThirdPersonView() && !mc->cameraTargetPlayer->isSleeping()) { - // add null pointer check to itemInHandRenderer to prevent a occasional seg fault + // 4jcraft: add null pointer check to itemInHandRenderer to prevent a occasional seg fault if (itemInHandRenderer != nullptr) { itemInHandRenderer->renderScreenEffect(a); } @@ -1074,7 +1074,7 @@ void GameRenderer::render(float a, bool bFirst) int xMouse = Mouse::getX() * screenWidth / fbw; int yMouse = screenHeight - Mouse::getY() * screenHeight / fbh - 1; - int maxFps = 0;//getFpsCap(mc->options->framerateLimit); + int maxFps = getFpsCap(mc->options->framerateLimit); if (mc->level != NULL) { diff --git a/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp b/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp index cb6d2a42c..6fcf4a4b2 100644 --- a/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp +++ b/Minecraft.World/Network/Packets/SetEntityMotionPacket.cpp @@ -77,7 +77,10 @@ void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException { if( useBytes ) { - // Masking the id to 11 bits before writing to account for large entitty ids. + // 4jcraft: masking the id to 11 bits before writing to account for entity ids > 4095. + // This fixes a connection drop when loading the tutorial world on linux. + // + // FIXME: find the root cause of this, since there shouldn't be more than 4095 entities. dos->writeShort((id & 0x07FF) | 0x800); dos->writeByte(xa/16); dos->writeByte(ya/16); @@ -85,7 +88,7 @@ void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException } else { - // same thing as line 80 here + // 4jcraft: same thing as line 80 here dos->writeShort((id & 0x07FF)); dos->writeShort(xa); dos->writeShort(ya);