-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
3,320 additions
and
195 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
33 changes: 33 additions & 0 deletions
33
common/src/main/java/dev/vexor/radium/extra/client/ClientTickHandler.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,33 @@ | ||
package dev.vexor.radium.extra.client; | ||
|
||
import com.google.common.collect.EvictingQueue; | ||
import dev.vexor.radium.mixin.extra.gui.MinecraftClientAccessor; | ||
import net.minecraft.client.MinecraftClient; | ||
|
||
import java.util.Comparator; | ||
import java.util.Queue; | ||
|
||
public class ClientTickHandler { | ||
private final Queue<Integer> fpsQueue = EvictingQueue.create(200); | ||
private int averageFps, lowestFps, highestFps; | ||
|
||
public void onClientTick(MinecraftClient client) { | ||
int currentFPS = MinecraftClient.getCurrentFps(); | ||
this.fpsQueue.add(currentFPS); | ||
this.averageFps = (int) this.fpsQueue.stream().mapToInt(Integer::intValue).average().orElse(0); | ||
this.lowestFps = this.fpsQueue.stream().min(Comparator.comparingInt(e -> e)).orElse(0); | ||
this.highestFps = this.fpsQueue.stream().max(Comparator.comparingInt(e -> e)).orElse(0); | ||
} | ||
|
||
public int getAverageFps() { | ||
return this.averageFps; | ||
} | ||
|
||
public int getLowestFps() { | ||
return this.lowestFps; | ||
} | ||
|
||
public int getHighestFps() { | ||
return this.highestFps; | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
common/src/main/java/dev/vexor/radium/extra/client/SodiumExtraClientMod.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,102 @@ | ||
package dev.vexor.radium.extra.client; | ||
|
||
import dev.vexor.radium.extra.client.gui.SodiumExtraGameOptions; | ||
import dev.vexor.radium.extra.client.gui.SodiumExtraHud; | ||
import dev.vexor.radium.mixinconfig.CaffeineConfig; | ||
import net.caffeinemc.mods.sodium.client.services.PlatformRuntimeInformation; | ||
import net.minecraft.client.MinecraftClient; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class SodiumExtraClientMod { | ||
|
||
private static final ClientTickHandler clientTickHandler = new ClientTickHandler(); | ||
private static SodiumExtraGameOptions CONFIG; | ||
private static CaffeineConfig MIXIN_CONFIG; | ||
private static Logger LOGGER; | ||
private static SodiumExtraHud hud; | ||
|
||
public static Logger logger() { | ||
if (LOGGER == null) { | ||
LOGGER = LogManager.getLogger("Sodium Extra"); | ||
} | ||
|
||
return LOGGER; | ||
} | ||
|
||
public static SodiumExtraGameOptions options() { | ||
if (CONFIG == null) { | ||
CONFIG = loadConfig(); | ||
} | ||
|
||
return CONFIG; | ||
} | ||
|
||
public static CaffeineConfig mixinConfig() { | ||
if (MIXIN_CONFIG == null) { | ||
MIXIN_CONFIG = CaffeineConfig.builder("Radium").withSettingsKey("sodium-extra:options") | ||
.addMixinOption("core", true, false) | ||
.addMixinOption("adaptive_sync", true) | ||
.addMixinOption("animation", true) | ||
.addMixinOption("biome_colors", true) | ||
.addMixinOption("cloud", true) | ||
.addMixinOption("compat", true, false) | ||
.addMixinOption("fog", true) | ||
.addMixinOption("fog_falloff", true) | ||
.addMixinOption("gui", true) | ||
.addMixinOption("instant_sneak", true) | ||
.addMixinOption("light_updates", true) | ||
.addMixinOption("optimizations", true) | ||
.addMixinOption("optimizations.beacon_beam_rendering", true) | ||
.addMixinOption("optimizations.draw_helpers", false) | ||
.addMixinOption("particle", true) | ||
.addMixinOption("prevent_shaders", true) | ||
.addMixinOption("reduce_resolution_on_mac", true) | ||
.addMixinOption("render", true) | ||
.addMixinOption("render.block", true) | ||
.addMixinOption("render.block.entity", true) | ||
.addMixinOption("render.entity", true) | ||
.addMixinOption("sky", true) | ||
.addMixinOption("sky_colors", true) | ||
.addMixinOption("sodium", true) | ||
.addMixinOption("sodium.accessibility", true) | ||
.addMixinOption("sodium.fog", true) | ||
.addMixinOption("sodium.cloud", true) | ||
.addMixinOption("sodium.resolution", true) | ||
.addMixinOption("sodium.scrollable_page", true) | ||
.addMixinOption("sodium.vsync", true) | ||
.addMixinOption("stars", true) | ||
.addMixinOption("steady_debug_hud", true) | ||
.addMixinOption("sun_moon", true) | ||
.addMixinOption("toasts", true) | ||
|
||
//.withLogger(SodiumExtraClientMod.logger()) | ||
.withInfoUrl("https://github.com/FlashyReese/sodium-extra-fabric/wiki/Configuration-File") | ||
.build(PlatformRuntimeInformation.getInstance().getConfigDirectory().resolve("sodium-extra.properties")); | ||
} | ||
return MIXIN_CONFIG; | ||
} | ||
|
||
public static ClientTickHandler getClientTickHandler() { | ||
return clientTickHandler; | ||
} | ||
|
||
private static SodiumExtraGameOptions loadConfig() { | ||
return SodiumExtraGameOptions.load(PlatformRuntimeInformation.getInstance().getConfigDirectory().resolve("sodium-extra-options.json").toFile()); | ||
} | ||
|
||
public static void onTick(MinecraftClient client) { | ||
if (hud == null) { | ||
hud = new SodiumExtraHud(); | ||
} | ||
clientTickHandler.onClientTick(client); | ||
hud.onStartTick(client); | ||
} | ||
|
||
public static void onHudRender() { | ||
if (hud == null) { | ||
hud = new SodiumExtraHud(); | ||
} | ||
hud.onHudRender(); | ||
} | ||
} |
Oops, something went wrong.