From d6b79f8b06b3a8ae2354a882537a26d6a9656fa6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Sep 2025 11:28:11 -0500 Subject: [PATCH] fix concurrency issue during unexplored fog setup --- .../seibel/distanthorizons/core/level/AbstractDhLevel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhLevel.java b/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhLevel.java index 96ea06a5e..c923b82d2 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhLevel.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhLevel.java @@ -371,8 +371,12 @@ public abstract class AbstractDhLevel implements IDhLevel // unexplored fog // //================// - public IDhApiRenderableBoxGroup getUnexploredFogRenderableBoxGroup() + // TODO potentially merge how this and getGenericRenderer() are handled + // synchronized to prevent issues with two threads getting the same un-initalized group at the same time + public synchronized IDhApiRenderableBoxGroup getUnexploredFogRenderableBoxGroup() { + // lazy setup to prevent issues on server levels and + // prevent order issues with the genericRenderer if (this.unexploredFogRenderableBoxGroup == null) { this.unexploredFogRenderableBoxGroup = GenericRenderObjectFactory.INSTANCE.createAbsolutePositionedGroup(ModInfo.NAME+":UnexploredFog", new ArrayList<>(512));