diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java index 2a91bc4e7..05396f653 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -32,6 +32,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.WrapperFactory; import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper; +import com.seibel.distanthorizons.common.wrappers.world.DimensionTypeWrapper; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; @@ -43,6 +44,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; import com.mojang.math.Vector3f; #else import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import org.joml.Vector3f; #endif @@ -50,8 +52,6 @@ import org.joml.Vector3f; import net.minecraft.client.renderer.chunk.SectionRenderDispatcher; #endif -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.coreapi.util.math.Mat4f; import com.seibel.distanthorizons.coreapi.util.math.Vec3d; import com.seibel.distanthorizons.coreapi.util.math.Vec3f; @@ -67,8 +67,6 @@ import net.minecraft.client.renderer.FogRenderer; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; #if PRE_MC_1_17_1 import net.minecraft.tags.FluidTags; import net.minecraft.world.level.material.FluidState; @@ -103,7 +101,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper * In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps.
* Requiring the use of multiple {@link LightMapWrapper}. */ - public HashMap lightmapByLevelWrapper = new HashMap<>(); + public HashMap lightmapByDimensionType = new HashMap<>(); @@ -347,7 +345,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper } @Override - public ILightMapWrapper getLightmapWrapper(ILevelWrapper level) { return this.lightmapByLevelWrapper.get(level); } + public ILightMapWrapper getLightmapWrapper(ILevelWrapper level) { return this.lightmapByDimensionType.get(level); } @Override public boolean isFogStateSpecial() @@ -368,11 +366,16 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper public void updateLightmap(NativeImage lightPixels, IClientLevelWrapper level) { - if (!this.lightmapByLevelWrapper.containsKey(level)) + // Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same + // object for the same MC level and/or the same hash, + // so this will have to do for now + IDimensionTypeWrapper dimensionType = level.getDimensionType(); + + if (!this.lightmapByDimensionType.containsKey(dimensionType)) { - this.lightmapByLevelWrapper.put(level, new LightMapWrapper()); + this.lightmapByDimensionType.put(dimensionType, new LightMapWrapper()); } - this.lightmapByLevelWrapper.get(level).uploadLightmap(lightPixels); + this.lightmapByDimensionType.get(dimensionType).uploadLightmap(lightPixels); } } diff --git a/coreSubProjects b/coreSubProjects index 2d4f057eb..146d9da41 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2d4f057eb067c1902c029992c5f0479e03bc126e +Subproject commit 146d9da417a3b98b5c127ca4a2f7ae2ef14f842e