Update core.

This commit is contained in:
TomTheFurry
2022-04-02 15:25:28 +08:00
parent 15e5a04ffd
commit 2289d898ce
4 changed files with 31 additions and 7 deletions
@@ -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()
@@ -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();
}
}
@@ -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;
+1 -1
Submodule core updated: 4bac38c99f...6d12acc30a