mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-27 23:46:01 +00:00
Fix signs being ungodly bright (#2185)
This commit is contained in:
1 parent
8387b4e9cd
commit
bc08e4baed
5 files changed
+51
-12
No files matched your search
@@ -30,6 +30,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.Viewport;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -368,6 +369,15 @@ public class DynamicLights {
|
||||
return this.getLightmapWithDynamicLight(this.getDynamicLightLevel(x, y, z), lightmap);
|
||||
}
|
||||
|
||||
public static int addDynamicLight(IBlockAccess world, int x, int y, int z, int lightmap) {
|
||||
if (!isEnabled()) return lightmap;
|
||||
final DynamicLights dl = get();
|
||||
if (!dl.hasLightSources()) return lightmap;
|
||||
final double dynamicLightLevel = dl.getDynamicLightLevel(x, y, z);
|
||||
if (dynamicLightLevel > 0 && !world.getBlock(x, y, z).isOpaqueCube()) return dl.getLightmapWithDynamicLight(dynamicLightLevel, lightmap);
|
||||
return lightmap;
|
||||
}
|
||||
|
||||
public List<IDynamicLightSource> getSourcesForChunk(int chunkMinX, int chunkMinY, int chunkMinZ) {
|
||||
// Chunk center
|
||||
final double centerX = chunkMinX + 8.0;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.gtnewhorizons.angelica.rendering.tesr;
|
||||
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Try to replicate modern behavior for when shaderpacks are in use.*/
|
||||
public final class TileEntityLight {
|
||||
|
||||
private TileEntityLight() {}
|
||||
|
||||
public static int packedLight(World world, int x, int y, int z, int vanillaLight) {
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
if (!block.getUseNeighborBrightness() || block.getLightOpacity() != 0) return vanillaLight;
|
||||
final int sky = world.provider.hasNoSky ? 0 : world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z);
|
||||
final int blockLight = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y, z), block.getLightValue(world, x, y, z));
|
||||
return DynamicLights.addDynamicLight(world, x, y, z, sky << 20 | blockLight << 4);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user