Skip to content

Commit

Permalink
Prevent Fabulous from crashing the game
Browse files Browse the repository at this point in the history
Fixes #2495
  • Loading branch information
IMS212 committed Oct 25, 2024
1 parent fa3fb7f commit 2cc2552
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static OptionImpl<Options, SupportedGraphicsMode> createLimitedVideoSett
new Component[]{Component.translatable("options.graphics.fast"), Component.translatable("options.graphics.fancy")}))
.setBinding(
(opts, value) -> opts.graphicsMode().set(value.toVanilla()),
opts -> SupportedGraphicsMode.fromVanilla(opts.graphicsMode().get()))
opts -> SupportedGraphicsMode.fromVanilla(opts.graphicsMode()))
.setImpact(OptionImpact.HIGH)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package net.irisshaders.iris.fantastic;

import net.irisshaders.iris.Iris;
import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.OptionInstance;

public enum SupportedGraphicsMode {
FAST,
FANCY;

public static SupportedGraphicsMode fromVanilla(GraphicsStatus status) {
return switch (status) {
public static SupportedGraphicsMode fromVanilla(OptionInstance<GraphicsStatus> status) {
return switch (status.get()) {
case FAST -> FAST;
case FANCY -> FANCY;
case FABULOUS -> throw new IllegalStateException("Fabulous graphics mode is not supported by Iris");
case FABULOUS -> {
Iris.logger.warn("Detected Fabulous Graphics being used somehow, changing to Fancy!");
status.set(GraphicsStatus.FANCY);
yield FANCY;
}
};
}

Expand Down

0 comments on commit 2cc2552

Please sign in to comment.