3
3
import com .google .common .base .Throwables ;
4
4
import com .mojang .blaze3d .platform .GlDebug ;
5
5
import com .mojang .blaze3d .platform .InputConstants ;
6
+ import com .sun .jna .platform .unix .LibC ;
6
7
import net .coderbot .iris .config .IrisConfig ;
7
8
import net .coderbot .iris .gl .GLDebug ;
8
9
import net .coderbot .iris .gl .shader .ShaderCompileException ;
27
28
import net .coderbot .iris .texture .pbr .PBRTextureManager ;
28
29
import net .minecraft .ChatFormatting ;
29
30
import net .minecraft .SharedConstants ;
31
+ import net .minecraft .Util ;
30
32
import net .minecraft .client .KeyMapping ;
31
33
import net .minecraft .client .Minecraft ;
32
34
import net .minecraft .client .multiplayer .ClientLevel ;
46
48
import net .minecraftforge .network .NetworkConstants ;
47
49
import org .jetbrains .annotations .NotNull ;
48
50
import org .lwjgl .glfw .GLFW ;
51
+ import org .lwjgl .system .Configuration ;
49
52
50
53
import java .io .IOException ;
51
54
import java .io .InputStream ;
@@ -89,9 +92,10 @@ public class Iris {
89
92
private static PipelineManager pipelineManager ;
90
93
private static IrisConfig irisConfig ;
91
94
private static FileSystem zipFileSystem ;
92
- private static KeyMapping reloadKeybind ;
93
- private static KeyMapping toggleShadersKeybind ;
94
- private static KeyMapping shaderpackScreenKeybind ;
95
+ private static final KeyMapping reloadKeybind = new KeyMapping ("iris.keybind.reload" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_R , "iris.keybinds" );
96
+ private static final KeyMapping toggleShadersKeybind = new KeyMapping ("iris.keybind.toggleShaders" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_K , "iris.keybinds" );
97
+ private static final KeyMapping shaderpackScreenKeybind = new KeyMapping ("iris.keybind.shaderPackSelection" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_O , "iris.keybinds" );
98
+ private static final KeyMapping wireframeKeybind = new KeyMapping ("iris.keybind.wireframe" , InputConstants .Type .KEYSYM , InputConstants .UNKNOWN .getValue (), "iris.keybinds" );
95
99
96
100
private static final Map <String , String > shaderPackOptionQueue = new HashMap <>();
97
101
// Flag variable used when reloading
@@ -103,7 +107,7 @@ public class Iris {
103
107
private static boolean fallback ;
104
108
105
109
// Change this for snapshots!
106
- private static String backupVersionNumber = "1.19.4 " ;
110
+ private static String backupVersionNumber = "1.20.3 " ;
107
111
108
112
public Iris () {
109
113
try {
@@ -127,11 +131,7 @@ public Iris() {
127
131
*
128
132
* <p>This is called right before options are loaded, so we can add key bindings here.</p>
129
133
*/
130
- public void onEarlyInitialize () {
131
- reloadKeybind = new KeyMapping ("iris.keybind.reload" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_R , "iris.keybinds" );
132
- toggleShadersKeybind = new KeyMapping ("iris.keybind.toggleShaders" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_K , "iris.keybinds" );
133
- shaderpackScreenKeybind = new KeyMapping ("iris.keybind.shaderPackSelection" , InputConstants .Type .KEYSYM , GLFW .GLFW_KEY_O , "iris.keybinds" );
134
-
134
+ public static void onEarlyInitialize () {
135
135
try {
136
136
if (!Files .exists (getShaderpacksDirectory ())) {
137
137
Files .createDirectories (getShaderpacksDirectory ());
@@ -230,9 +230,17 @@ public static void handleKeybinds(Minecraft minecraft) {
230
230
}
231
231
} else if (shaderpackScreenKeybind .consumeClick ()) {
232
232
minecraft .setScreen (new ShaderPackScreen (null ));
233
+ } else if (wireframeKeybind .consumeClick ()) {
234
+ if (irisConfig .areDebugOptionsEnabled () && minecraft .player != null && !Minecraft .getInstance ().isLocalServer ()) {
235
+ minecraft .player .displayClientMessage (Component .literal ("No cheating; wireframe only in singleplayer!" ), false );
236
+ }
233
237
}
234
238
}
235
239
240
+ public static boolean shouldActivateWireframe () {
241
+ return irisConfig .areDebugOptionsEnabled () && wireframeKeybind .isDown ();
242
+ }
243
+
236
244
public static void toggleShaders (Minecraft minecraft , boolean enabled ) throws IOException {
237
245
irisConfig .setShadersEnabled (enabled );
238
246
irisConfig .save ();
0 commit comments