Skip to content

Instantly share code, notes, and snippets.

@sathonay
Last active February 16, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sathonay/1d1c1a08a13c1fcbcd085ac766112a51 to your computer and use it in GitHub Desktop.
Save sathonay/1d1c1a08a13c1fcbcd085ac766112a51 to your computer and use it in GitHub Desktop.
Minecraft fullscreen no bound (in the toggleFullscreen() method)
From 7b00212f0c3ea867e427c087fabd6424b13801db Mon Sep 17 00:00:00 2001
From: Alexis <33222808+sathonay@users.noreply.github.com>
Date: Wed, 10 Feb 2021 18:27:02 +0100
Subject: [PATCH 1/3] FullScreen no bound FIX
---
net/minecraft/client/Minecraft.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/minecraft/client/Minecraft.java b/net/minecraft/client/Minecraft.java
index 0b468f6..5f04329 100644
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -1703,7 +1703,9 @@ public class Minecraft implements IThreadListener, IPlayerUsage
this.updateFramebufferSize();
}
- Display.setFullscreen(this.fullscreen);
+ Display.setFullscreen(false);
+ Display.setResizable(fullscreen);
+ System.setProperty("org.lwjgl.opengl.Window.undecorated", String.valueOf(!fullscreen));
Display.setVSyncEnabled(this.gameSettings.enableVsync);
this.updateDisplay();
}
--
2.28.0.windows.1
From f415f689c8aa3f427d734693f547a4086c18b21a Mon Sep 17 00:00:00 2001
From: Alexis <33222808+sathonay@users.noreply.github.com>
Date: Wed, 10 Feb 2021 19:07:00 +0100
Subject: [PATCH 3/3] Fix fullscreen no bound
---
net/minecraft/client/Minecraft.java | 49 +++++++----------------------
1 file changed, 12 insertions(+), 37 deletions(-)
diff --git a/net/minecraft/client/Minecraft.java b/net/minecraft/client/Minecraft.java
index 5f04329..129bbb3 100644
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -1650,7 +1650,7 @@ public class Minecraft implements IThreadListener, IPlayerUsage
}
//}
}
-
+
/**
* Toggles fullscreen mode.
*/
@@ -1661,51 +1661,26 @@ public class Minecraft implements IThreadListener, IPlayerUsage
this.fullscreen = !this.fullscreen;
this.gameSettings.fullScreen = this.fullscreen;
- if (this.fullscreen)
- {
+ if (this.fullscreen) {
this.updateDisplayMode();
this.displayWidth = Display.getDisplayMode().getWidth();
this.displayHeight = Display.getDisplayMode().getHeight();
-
- if (this.displayWidth <= 0)
- {
- this.displayWidth = 1;
- }
-
- if (this.displayHeight <= 0)
- {
- this.displayHeight = 1;
- }
- }
- else
- {
+ } else {
Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
this.displayWidth = this.tempDisplayWidth;
this.displayHeight = this.tempDisplayHeight;
-
- if (this.displayWidth <= 0)
- {
- this.displayWidth = 1;
- }
-
- if (this.displayHeight <= 0)
- {
- this.displayHeight = 1;
- }
- }
-
- if (this.currentScreen != null)
- {
- this.resize(this.displayWidth, this.displayHeight);
- }
- else
- {
- this.updateFramebufferSize();
}
+
+ if (this.displayWidth <= 0) this.displayWidth = 1;
+ if (this.displayHeight <= 0) this.displayHeight = 1;
+ if (this.currentScreen != null) this.resize(this.displayWidth, this.displayHeight);
+ else this.updateFramebufferSize();
+
+ System.setProperty("org.lwjgl.opengl.Window.undecorated", String.valueOf(fullscreen));
+ Display.setDisplayMode(fullscreen ? Display.getDesktopDisplayMode() : new DisplayMode(displayWidth, displayHeight));
+ Display.setResizable(!fullscreen);
Display.setFullscreen(false);
- Display.setResizable(fullscreen);
- System.setProperty("org.lwjgl.opengl.Window.undecorated", String.valueOf(!fullscreen));
Display.setVSyncEnabled(this.gameSettings.enableVsync);
this.updateDisplay();
}
--
2.28.0.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment