Exposure

Exposure

5M Downloads

Error spam when using Immersive Optimizations and a photography frame exists

Closed this issue · 2 comments

commented

Description

All is normal until adding a Photography Frame to the world, after which the error below starts getting spammed.

I have also created an issue in the Immersive Optimizations repository.

Versions

Minecraft: 1.21.1
Neoforge: 21.1.160
Exposure: 1.9.1
Immersive Optimizations: 0.0.4

Error log

java.lang.IllegalStateException: Cannot get config value before config is loaded.
    at MC-BOOTSTRAP/[email protected]/com.google.common.base.Preconditions.checkState(Preconditions.java:512)
    at TRANSFORMER/[email protected]/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.getRaw(ModConfigSpec.java:1235)
    at TRANSFORMER/[email protected]/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.get(ModConfigSpec.java:1222)
    at TRANSFORMER/[email protected]/io.github.mortuusars.exposure.world.entity.PhotographFrameEntity.shouldRenderAtSqrDistance(PhotographFrameEntity.java:78)
    at TRANSFORMER/[email protected]/net.conczin.immersive_optimization.TickScheduler.getPriority(TickScheduler.java:274)
    at TRANSFORMER/[email protected]/net.conczin.immersive_optimization.TickScheduler.lambda$tickLevel$0(TickScheduler.java:210)
    at MC-BOOTSTRAP/[email protected]/it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap$1.forEach(Int2ObjectLinkedOpenHashMap.java:1719)
    at TRANSFORMER/[email protected]/net.conczin.immersive_optimization.TickScheduler.tickLevel(TickScheduler.java:208)
    at TRANSFORMER/[email protected]/net.conczin.immersive_optimization.TickScheduler$Worker.run(TickScheduler.java:68)
    at java.base/java.lang.Thread.run(Unknown Source)
commented

This happens because shouldRenderAtSqrDistance in https://github.com/mortuusars/Exposure/blob/d0e06654ea4dc1b2bc01389c0977dd5202d23409/common/src/main/java/io/github/mortuusars/exposure/world/entity/PhotographFrameEntity.java#L77C20-L77C45 expects to be client sided.

I would argue that, despite not being used in vanilla, this function should be server safe as well since it's in Entity (not renderer) and not marked as sided.
In any case, I will move away from using that method on dedicated servers since its inaccurate anyway.

And to link the issues: Luke100000/ImmersiveOptimization#7

commented

In 1.9.2 I've added a check before accessing client config in this method.