From 2289d898ce4c506b91f5ef58039e10f9ef630937 Mon Sep 17 00:00:00 2001 From: TomTheFurry Date: Sat, 2 Apr 2022 15:25:28 +0800 Subject: [PATCH] Update core. --- .../minecraft/MinecraftRenderWrapper.java | 17 +++++++++++------ .../common/wrappers/misc/LightMapWrapper.java | 18 ++++++++++++++++++ common/src/main/resources/lod.accesswidener | 1 + core | 2 +- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java index 370d605d8..c7c0afd24 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -10,11 +10,9 @@ import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.systems.RenderSystem; import com.seibel.lod.common.wrappers.misc.LightMapWrapper; import com.seibel.lod.core.api.ApiShared; -import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler; -import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; -import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper; import net.minecraft.client.renderer.LightTexture; import com.mojang.math.Vector3f; @@ -219,8 +217,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper public int[] getLightmapPixels() { LightTexture tex = GAME_RENDERER.lightTexture(); - tex.tick(); // This call makes no sense, but it fixes pause menu flicker bug - NativeImage lightMapPixels = tex.lightPixels; + //tex.tick(); // This call makes no sense, but it fixes pause menu flicker bug + NativeImage lightMapPixels = tex.lightTexture.getPixels(); LightMapWrapper lightMap = new LightMapWrapper(lightMapPixels); @@ -260,7 +258,14 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper return pixels; } - + + @Override + public ILightMapWrapper getLightmapWrapper() { + return new LightMapWrapper(GAME_RENDERER.lightTexture()); + } + + + @Override public int getLightmapTextureHeight() diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/misc/LightMapWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/misc/LightMapWrapper.java index c05c61a29..eb7c61ce9 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/misc/LightMapWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/misc/LightMapWrapper.java @@ -2,6 +2,7 @@ package com.seibel.lod.common.wrappers.misc; import com.mojang.blaze3d.platform.NativeImage; import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper; +import net.minecraft.client.renderer.LightTexture; /** * @author James Seibel @@ -11,11 +12,17 @@ public class LightMapWrapper implements ILightMapWrapper { static NativeImage lightMap = null; + private LightTexture tex; + public LightMapWrapper(NativeImage newLightMap) { lightMap = newLightMap; } + public LightMapWrapper(LightTexture lightTexture) { + tex = lightTexture; + } + public static void setLightMap(NativeImage newLightMap) { lightMap = newLightMap; @@ -26,4 +33,15 @@ public class LightMapWrapper implements ILightMapWrapper { return lightMap.getPixelRGBA(skyLight, blockLight); } + + @Override + public int bind() { + tex.turnOnLightLayer(); + return 3553; //GL.GL_TEXTURE_2D + } + + @Override + public void unbind() { + tex.turnOffLightLayer(); + } } diff --git a/common/src/main/resources/lod.accesswidener b/common/src/main/resources/lod.accesswidener index 564f2d77b..ed26f411a 100644 --- a/common/src/main/resources/lod.accesswidener +++ b/common/src/main/resources/lod.accesswidener @@ -16,6 +16,7 @@ accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chu # lighting accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage; +accessible field net/minecraft/client/renderer/LightTexture lightTexture Lnet/minecraft/client/renderer/texture/DynamicTexture; accessible field net/minecraft/world/level/lighting/LevelLightEngine blockEngine Lnet/minecraft/world/level/lighting/LayerLightEngine; accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine; diff --git a/core b/core index 4bac38c99..6d12acc30 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 4bac38c99fd10d4524fb8f568ea5b7a766578900 +Subproject commit 6d12acc30a2db4d47eb7e79c2a8acc130c5480d0