Merge branch 'dev' into dev

This commit is contained in:
Mathiew May 2026-03-10 09:42:30 -04:00 committed by GitHub
commit 02dddf1cb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 17 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

@ -1,4 +1,5 @@
# Contributing to 4JCraft
Thank you for considering contributing to 4JCraft! We appreciate all types of contributions, including bug fixes, new features, and documentation improvements.
Before you start contributing, please take a moment to review the guidelines outlined here. This ensures a smooth collaboration and helps maintain the project's quality.
@ -15,12 +16,54 @@ Make sure to follow the guidelines below when submitting code or issues.
## Submitting code
Simple rules for publishing code:
- Do not publish AI-generated or LLM generated code
- Publish your new code in a new branch
- Join our Discord server to ping us (the lead developers) about your pull requests
- Keep your code clean and readable.
- Use conventional commits (this is not required)
Make sure your code compiles before making a pull request! and make sure that it's readable
If you are submitting a pull request to this repository, here are some guidelines to keep in mind.
Remember ALL your changes will be licensed under GNU General Public License V3.0.
### Test your changes.
Please run the game and make sure your code runs as expected before marking a pull request ready for review.
### Keep scope to a minimum.
Pull requests should ideally do one thing in one place. Avoiding opening massive pull requests that change multiple components of the game. These are often not reviewable and result in unmanageable conflicts with other active PRs.
### Use common sense with commits.
Commit names should clearly describe what was changed in the commit. [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) are generally appreciated, but by no means required. Similar to pull requests, commits should ideally be limited in scope and easy to track over time.
### Keep code clean and readable.
At this time, we do not have a style guide or rules for how code should be formatted. In general, code should be readable and try to match the styling and conventions of whatever is around it.
### Avoid changing in-game behavior.
At this time, we are trying to stay as close to the vanilla game as close as possible. Anything that changes game behavior in breaking ways will likely be closed. This includes adding new features or backporting newer functionality from other (non-LCE) versions of the game.
> Some exceptions to this guideline apply. Features required for platform porting (such as adding new input methods) are considered in-scope. In some cases, temporary "stop-gap" implementations or additional functionality may be accepted on a case-by-case basis, provided it is clearly documented and possible to disable through a compiler flag.
### Bugfixes should be clearly commented.
If you are submitting a minor addition to *game-relevant code*, clearly comment the purpose of this in a comment starting with `// 4jcraft:`. This indicates a patch over the original game code and lets us keep track of what has been modified in case it needs to be reverted later.
> **Example:**
>
> ```cpp
> // 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);
> ```
This rule may not apply to contributions fixing *trivially incorrect* 4J code that affects all platforms, such as instances of undefined behavior.
### Try to fix the cause, not the effect.
If you are fixing a bug, avoid submitting "hacks" that attempt to patch the effects of the bug rather than the root cause.
> Exceptions to this rule may apply depending on the severity of the bug, provided that the code is clearly commented as a hack with a relevant `// 4jcraft:` comment.
### Don't submit code written by AI.
Submitting code to this repository authored by generative AI tools (LLMs, agentic coding tools, etc...) is strictly forbidden. Pull requests that are clearly vibe-coded or written by an LLM will be closed.
> **Rationale:** Contributors are expected to both fully understand the code that they write **and** have the necessary skills to *maintain it*. Opening PRs containing code that you did not write yourself more often than not fails to meet either of these expectations, therefore it is disallowed.

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

@ -23,7 +23,7 @@ At the moment, we're aiming to support the following platforms:
- Android (not started)
> [!WARNING]
> There NO Windows support, for that, go to [smartcmd/MinecraftConsoles](https://github.com/smartcmd/MinecraftConsoles/).
> There is NO Windows support, for that, go to [smartcmd/MinecraftConsoles](https://github.com/smartcmd/MinecraftConsoles/).
> All efforts are focused towards a native Linux port, OpenGL rendering pipeline, and modernizing the existing LCE codebase/tooling to make future platform ports easier.
>