mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-13 17:04:15 +00:00
Add HUDCaching FPS (from PolyPatcher)
This commit is contained in:
1 parent
f79e112700
commit
7e4292bdba
2 files changed
+13
-8
No files matched your search
@@ -70,11 +70,16 @@ public class AngelicaConfig {
|
||||
@Config.DefaultBoolean(true)
|
||||
public static boolean showSplashMemoryBar;
|
||||
|
||||
@Config.Comment("Renders the HUD elements once per tick and reuses the pixels to improve performance. [Experimental]")
|
||||
@Config.Comment("Renders the HUD elements once per 20 frames (by default) and reuses the pixels to improve performance. [Experimental]")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableHudCaching;
|
||||
|
||||
@Config.Comment("The amount of frames to wait before updating the HUD elements. [Experimental]")
|
||||
@Config.DefaultInt(20)
|
||||
@Config.RangeInt(min = 1, max = 60)
|
||||
public static int hudCachingFPS = 20;
|
||||
|
||||
@Config.Comment("Batch drawScreen fonts [Experimental]")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.early.angelica.hudcaching.RenderGameOverlayEventAccessor;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import net.dries007.holoInventory.client.Renderer;
|
||||
@@ -43,6 +44,7 @@ public class HUDCaching {
|
||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||
public static Framebuffer framebuffer;
|
||||
private static boolean dirty = true;
|
||||
private static long nextHudRefresh;
|
||||
|
||||
public static boolean renderingCacheOverride;
|
||||
|
||||
@@ -106,13 +108,6 @@ public class HUDCaching {
|
||||
|
||||
/* TODO END REMOVE DEBUG STUFF */
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// highest so it runs before the GLSM load event
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onJoinWorld(WorldEvent.Load event) {
|
||||
@@ -136,8 +131,13 @@ public class HUDCaching {
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > nextHudRefresh) {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
dirty = false;
|
||||
nextHudRefresh = System.currentTimeMillis() + (1000 / AngelicaConfig.hudCachingFPS);
|
||||
resetFramebuffer(mc.displayWidth, mc.displayHeight);
|
||||
framebuffer.bindFramebuffer(false);
|
||||
renderingCacheOverride = true;
|
||||
|
||||
Reference in new issue
Block a user