-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #193 from LostLuma/optimization-opt-out-neoforge
Allow other mods to disable the overlay optimization on (Neo)Forge
- Loading branch information
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
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
24 changes: 23 additions & 1 deletion
24
...forge/src/main/java/net/lostluma/dynamic_fps/impl/neoforge/service/NeoForgeModCompat.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 |
---|---|---|
@@ -1,16 +1,38 @@ | ||
package net.lostluma.dynamic_fps.impl.neoforge.service; | ||
|
||
import com.electronwill.nightconfig.core.CommentedConfig; | ||
import dynamic_fps.impl.service.ModCompat; | ||
import net.neoforged.fml.ModList; | ||
import net.neoforged.neoforgespi.language.IModInfo; | ||
|
||
public class NeoForgeModCompat implements ModCompat { | ||
private static boolean disableOverlayOptimization = false; | ||
|
||
static { | ||
ModList.get().getMods().forEach(NeoForgeModCompat::parseModMetadata); | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean disableOverlayOptimization() { | ||
return ModList.get().isLoaded("rrls"); | ||
return disableOverlayOptimization || ModList.get().isLoaded("rrls"); | ||
} | ||
|
||
private static void parseModMetadata(IModInfo modInfo) { | ||
Object config = modInfo.getModProperties().get("dynamic_fps"); | ||
|
||
if (config == null) { | ||
return; | ||
} | ||
|
||
Boolean value = ((CommentedConfig) config).get("optimized_overlay"); | ||
|
||
if (value != null && !value) { | ||
disableOverlayOptimization = true; | ||
} | ||
} | ||
} |