-
Bug
-
Resolution: Unresolved
-
None
-
1.20.4, 24w06a, 24w07a, 24w09a, 24w13a, 1.20.5 Pre-Release 1, 1.20.5 Pre-Release 2, 1.20.5, 24w18a, 24w21b, 1.21, 24w33a, 1.21.2 Pre-Release 3, 24w44a, 1.21.3
-
None
-
OS: Ubuntu 22.04 LTS
-
Confirmed
-
UI
-
Normal
-
Platform
Despite the laucnher having a minimal limit on how small the game window can be at start being 300x260 px, Minecraft itself can be resized to any size you want, causing bugs like MC-268490
Steps to reproduce:
- Open the Minecraft launcher, click on installations tab and click on any installation.
- In the opened window set the window size to 0x0. "Minimal resolution is 300x260." message appears.
- Open minecraft and try to resize minecraft to be as small as possible. Minecraft window can be smaller than 300x260
Observed result:
Minecraft window doesn't have a minimal width and height and can be smaller than 300x260
Expected result:
Minecraft window should have a minimal width and height being set to 300x260
Fix:
The following code is based on a decompiled version of 1.20.5 Pre-Release 1 using official mappings.
public final class Window implements AutoCloseable { ... public Window(WindowEventHandler $$0, ScreenManager $$1, DisplayData $$2, @Nullable String $$3, String $$4) { ... GLFW.glfwMakeContextCurrent(this.window); GL.createCapabilities(); this.setMode(); this.refreshFramebufferSize(); GLFW.glfwSetFramebufferSizeCallback(this.window, this::onFramebufferResize); GLFW.glfwSetWindowPosCallback(this.window, this::onMove); GLFW.glfwSetWindowSizeCallback(this.window, this::onResize); GLFW.glfwSetWindowFocusCallback(this.window, this::onFocus); GLFW.glfwSetCursorEnterCallback(this.window, this::onEnter); } ... }
As we can see, when the window is created, there is no restriction set to window size, this can be simply fixed by adding the following code at the end of Window function.
GLFW.glfwSetWindowSizeLimits(this.window, 300, 260, GLFW.GLFW_DONT_CARE, GLFW.GLFW_DONT_CARE); // Based of GLFW window guide https://www.glfw.org/docs/3.3/window_guide.html#window_sizelimits
- relates to
-
MC-268490 While being in a world Minecraft freezes if its width is set to 1 pixel
- Resolved