-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.7.1] Add support for forge 1.20.1
- Loading branch information
1 parent
4fa7b34
commit 0403613
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
.../src/main/java/me/earth/headlessmc/lwjgl/redirections/ForgeDisplayWindowRedirections.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package me.earth.headlessmc.lwjgl.redirections; | ||
|
||
import me.earth.headlessmc.lwjgl.api.RedirectionManager; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
import static me.earth.headlessmc.lwjgl.api.Redirection.of; | ||
|
||
/** | ||
* Forge 1.20.1 introduces the | ||
* {@code net.minecraftforge.fml.earlydisplay.DisplayWindow} class. | ||
*/ | ||
public class ForgeDisplayWindowRedirections { | ||
public static void redirect(RedirectionManager manager) { | ||
manager.redirect("Lorg/lwjgl/glfw/GLFW;glfwGetPrimaryMonitor()J", | ||
of(1L)); | ||
|
||
manager.redirect("Lorg/lwjgl/glfw/GLFW;" + | ||
"glfwCreateWindow(IILjava/lang/CharSequence;JJ)J", | ||
of(1L)); | ||
|
||
// act like we compiled shader | ||
manager.redirect("Lorg/lwjgl/opengl/GL20C;glGetShaderi(II)I", of(1)); | ||
manager.redirect("Lorg/lwjgl/opengl/GL20C;glGetProgrami(II)I", of(1)); | ||
|
||
manager.redirect("Lorg/lwjgl/stb/STBTruetype;" + | ||
"stbtt_InitFont(Lorg/lwjgl/stb/STBTTFontinfo;" + | ||
"Ljava/nio/ByteBuffer;)Z", of(true)); | ||
|
||
manager.redirect("Lorg/lwjgl/opengl/GL30C;glMapBufferRange(IJJI)" + | ||
"Ljava/nio/ByteBuffer;", | ||
(obj, desc, type, args) -> | ||
ByteBuffer.wrap(new byte[(int) ((long) args[2])])); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters