Skip to content

Commit

Permalink
Correct block lighting with Forge's internals
Browse files Browse the repository at this point in the history
now lighting in nether is absolutely identical to vanilla's, there is no skylight checks in MC's code on 1.12, maybe we should check this in Angelica too?:
  • Loading branch information
Asek3 committed Jan 25, 2024
1 parent d1a12f3 commit 190c589
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraftforge.client.model.pipeline.LightUtil;

import java.util.Arrays;
import java.util.Map;
Expand Down Expand Up @@ -440,26 +441,11 @@ public ChunkSectionPos getOrigin() {
return this.origin;
}

// Modern checks if the sky is darkened, which only happens in the nether. However, I think 1.7.10's hasNoSky is
// close enough and possibly a behavior change between versions. I also don't know why it's rotationally asymmetric
public float getBrightness(EnumFacing direction, boolean shaded) {
if (!shaded) {
return !world.provider.hasSkyLight() ? 0.9f : 1.0f;
}
switch (direction) {
case DOWN:
return !world.provider.hasSkyLight() ? 0.9f : 0.5f;
case UP:
return !world.provider.hasSkyLight() ? 0.9f : 1.0f;
case NORTH:
case SOUTH:
return 0.8f;
case WEST:
case EAST:
return 0.6f;
default:
return 1.0f;
}
return LightUtil.diffuseLight(direction);
}

// [VanillaCopy] PalettedContainer#toIndex
Expand Down

0 comments on commit 190c589

Please sign in to comment.