-
Bug
-
Resolution: Duplicate
-
None
-
Minecraft 1.7.5, Minecraft 14w11b
-
None
-
java 7 64 bit, win server 2008 r2
-
Unconfirmed
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 and my previous report ( https://bugs.mojang.com/browse/MC-7508 ) was closed because I didn't diligently check every month to update which version it applied to, as though it would magically fix itself despite the code not changing.
IMAGES ATTACHED:
visual explanation of bug, and shot of bug in action
- duplicates
-
MC-7508 lighting error due to Chunk.heightMap ignoring block at the top level of an ExtendedBlockStorage instance (off by 1 error)
- Resolved