-
Bug
-
Resolution: Fixed
-
Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02b, Snapshot 13w05b, Minecraft 1.5, Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 1.6, Minecraft 1.6.1, Minecraft 1.6.4, Minecraft 13w38c, Minecraft 1.7.5, Minecraft 14w11b, Minecraft 14w26c, Minecraft 1.7.10, Minecraft 14w28b, Minecraft 14w29a
-
java 7 64 bit, win server 2008 r2
-
Community Consensus
REPRODUCE
1: load the attached world (mirrored at http://www.mediafire.com/?8o5hj55pwjolwos )
2: walk under the platform. Watch the shadow disappear. This only happens with platforms at level 15, 31, 47, 63, etc, for the reasons described below
CONFIRM FROM SCRATCH
1: start a flat world.
2: Build a large 1 block thick platform at y level 31 (or 15 or 63)
3: exit.
4: Load world again. walk on the ground under the platform. Shadow from the platform disappears as the lighting is updated based on the heightmap (which does not see the platform)
THE CAUSE
Chunk.java has an error in the generation of heightMap (an int[256] ) in the method public void generateHeightMap().
int var1 = this.getTopFilledSegment();
returns the highest ExtendedBlockStorage with a block in it.
inside the x and z loops (from 0 to 16), for each x-z coordinate the method establishes the highest block with opacity > 0.
int var4 = var1 + 16 - 1;
starts us at the top of the ExtendedBlockStorage returned earlier, then it loops down to find the first block with opacity > 0.
The problem is an off by one error. The blocks that are checked are retrieved like so: Block var5 = this.func_150810_a(var2, var4 - 1, var3);
the "var4 - 1" is the problem. The top block is ignored / never checked.
If the top two blocks are solid, the heightmap is set to the height of the lower one. If the top block is solid, then the next four are air then the next is solid, the height map is set to 5 below the top block.
The method either needs to start checking at this.getTopFilledSegment() + 16 instead of this.getTopFilledSegment() + 16 - 1, or inside the loop check this.func_150810_a(var2, var4, var3) instead of this.func_150810_a(var2, var4 - 1, var3)
This bug (and related) is likely the cause of some of the lighting glitches seen. See attached image for a visual representation of this report. Also, all variables, classes and method names are from MCP. I of course do not have access to your internal codebase. Hopefully you can translate.
This bug has been around sine 1.8 BETA Please kill it
IMAGES ATTACHED:
visual explanation of bug, and shot of bug in action
- is duplicated by
-
MC-7442 Lighting error in superflat worlds.
- Resolved
-
MC-51752 lighting error due to Chunk.heightMap ignoring block at the top level of an ExtendedBlockStorage instance (off by 1 error)
- Resolved
- relates to
-
MC-80966 Lightcalculation of ChunkSelection faulty implemented resulting in client bugs (empty chunks don’t show light/render dark)
- Resolved
-
MC-13544 Wrong LC-values
- Resolved
-
MC-29490 1.7+ lighting bug / black spots
- Resolved
-
MC-55172 Mobs do not spawn at the heights 16, 32, 48, 64, 80... (Multiples of 16)
- Resolved
-
MC-63346 lighting error at heights Multiples of 16
- Resolved