Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ArrayOutOfBounds in F3 debug text handler #736

Merged
merged 2 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void onRenderOverlay(RenderGameOverlayEvent.Text event) {

if (srv != null) {
String s = String.format("Integrated server @ %.0f ms ticks", lastIntegratedTickTime);
event.left.add(1, s);
event.left.add(Math.min(event.left.size(), 1), s);
}
}
if (AngelicaConfig.showBlockDebugInfo && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
Expand Down Expand Up @@ -250,6 +250,8 @@ public void onRenderOverlay(RenderGameOverlayEvent.Text event) {
}
}
event.setCanceled(true);
// TODO don't cancel the event and render here,
// instead mixin into the vanilla code and add a background to it
/* render ourselves for modern background */
FontRenderer fontrenderer = mc.fontRenderer;
int fontColor = 0xe0e0e0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SodiumDebugScreenHandler {
public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.showDebugInfo) {
event.right.add(2, "Off-Heap: +" + ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed() / 1024L / 1024L + "MB");
event.right.add(Math.min(event.right.size(), 2), "Off-Heap: +" + ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed() / 1024L / 1024L + "MB");

event.right.add("");
event.right.add("Sodium (Embeddium) Renderer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.mitchej123.hodgepodge.client.HodgepodgeClient;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.coderbot.iris.Iris;
Expand Down Expand Up @@ -39,7 +38,7 @@ public class IrisDebugScreenHandler {
public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.showDebugInfo) {
event.right.add(2, "Direct Buffers: +" + iris$humanReadableByteCountBin(iris$directPool.getMemoryUsed()));
event.right.add(Math.min(event.right.size(), 2), "Direct Buffers: +" + iris$humanReadableByteCountBin(iris$directPool.getMemoryUsed()));

event.right.add("");

Expand All @@ -49,8 +48,8 @@ public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
} else {
event.right.add("[" + Iris.MODNAME + "] Shaders are disabled");
}
if(AngelicaConfig.speedupAnimations) {
event.right.add(9, "animationsMode: " + AngelicaMod.animationsMode);
if (AngelicaConfig.speedupAnimations) {
event.right.add(Math.min(event.right.size(), 9), "animationsMode: " + AngelicaMod.animationsMode);
}

Iris.getPipelineManager().getPipeline().ifPresent(pipeline -> pipeline.addDebugText(event.left));
Expand Down