chore: add comments for 4jcraft-added functionality, undo #135

This commit is contained in:
Tropical 2026-03-09 19:46:54 -05:00
parent ca48a01a81
commit e4868446bd
5 changed files with 15 additions and 10 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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)
{

View file

@ -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);