Amulet-Team / Amulet-Map-Editor

A new Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7.
https://www.amuletmc.com/
1.8k stars 125 forks source link

Java: Lighting values are not recalculated #44

Open MrManiac3 opened 4 years ago

MrManiac3 commented 4 years ago

When cutting a large object and pasting it somewhere else, the lighting doesn't update with the blocks. This happens with all light levels, from dark to light. Placing blocks and removing them where the lighting issues occur sometimes updates the light levels to reflect the new block placement, but not always.

I noticed someone else had lighting issues in issue #8 but this is with a different context. I also noticed in a comment on that issue that lighting calculations currently aren't done, but I wanted to put it to paper here.

gentlegiantJGC commented 3 years ago

Amulet-Team/Amulet-Core/pull/121 partially fixes this. This is still an issue before 1.14

gentlegiantJGC commented 3 years ago

I thought I had fixed this for 1.14+ worlds but apparently not. I thought the game recalculated lighting if it was not defined in the chunk which is partially true but it does not propagate the light from light emitting blocks.

Option 1) Leave it as it is and let the game recalculate the lighting. Light emitting blocks will look weird. Option 1a) Change the chunk status to force the lighting calculations. This will also run the spawn and heightmaps stages. One of which might be bad and the other good. Option 2) Revert it to the old behaviour. Light values are not modified. This looks fine when adding blocks but weird when removing them. Option 3) The proper solution (but would require a lot of work) is to fully recalculate the light. This would mean knowing the amount of light each block outputs/absorbs which as far as I know isn't readily available. This solution would also need to scale to modded worlds and future versions so a hard coded database is not ideal.

atmos6767 commented 3 years ago

The bug still exists, and is quite annoying when copy-pasting large objects, especially closed rooms. The inside of a completely closed chamber is bright as if there's direct sunlight emitting. Removing and replacing a block in that area sometimes solves the issue, but not always. However, converting the world from java to bedrock edition, and then reconverting it to java solves this problem. I used MCCToolChestPE to convert my world. Though the lighting value seems to be recalculated, other problems such as all door hinges being reset to right side, or chain directions being reset to vertical happened.

aboothered commented 3 years ago

The bug still exists, and is quite annoying when copy-pasting large objects, especially closed rooms. The inside of a completely closed chamber is bright as if there's direct sunlight emitting. Removing and replacing a block in that area sometimes solves the issue, but not always. However, converting the world from java to bedrock edition, and then reconverting it to java solves this problem. I used MCCToolChestPE to convert my world. Though the lighting value seems to be recalculated, other problems such as all door hinges being reset to right side, or chain directions being reset to vertical happened.

@atmos6767 I was about to post an issue about the lighting bugs on 1.13 version and below, so it is really good I came across your post :] Do you reckon the world might get corrupted in some way other than the ones you mentioned when converting it to and from bedrock?

atmos6767 commented 3 years ago

The bug still exists, and is quite annoying when copy-pasting large objects, especially closed rooms. The inside of a completely closed chamber is bright as if there's direct sunlight emitting. Removing and replacing a block in that area sometimes solves the issue, but not always. However, converting the world from java to bedrock edition, and then reconverting it to java solves this problem. I used MCCToolChestPE to convert my world. Though the lighting value seems to be recalculated, other problems such as all door hinges being reset to right side, or chain directions being reset to vertical happened.

@atmos6767 I was about to post an issue about the lighting bugs on 1.13 version and below, so it is really good I came across your post :] Do you reckon the world might get corrupted in some way other than the ones you mentioned when converting it to and from bedrock?

I don't think there are some major issues when converting and reconverting the world. Blocks that can possess multiple conditions(e.g glass panes, doors, fences, chains, cakes, etc) seems to be completely reset to their original state. And the connection between glass panes, fences are all gone. For other ordinary blocks, I couldn't find any problems.

ffernn-dev commented 2 years ago

Hey just leaving this here in case anyone has the same problems I did, if you're running a server and you need to fix lighting, instead of downloading the world and doing the optimize, clear cache etc, you can add --forceUpgrade --eraseCache to the end of your startup options (NOT JVM ARGUMENTS, it should go after nogui)

adsau59 commented 2 years ago

Hey just leaving this here in case anyone has the same problems I did, if you're running a server and you need to fix lighting, instead of downloading the world and doing the optimize, clear cache etc, you can add --forceUpgrade --eraseCache to the end of your startup options (NOT JVM ARGUMENTS, it should go after nogui)

worked for me thanks :)

jeffswt commented 1 year ago

Hey just leaving this here in case anyone has the same problems I did, if you're running a server and you need to fix lighting, instead of downloading the world and doing the optimize, clear cache etc, you can add --forceUpgrade --eraseCache to the end of your startup options (NOT JVM ARGUMENTS, it should go after nogui)

For 1.19+ single player worlds, 'Edit > Optimize World > Erase Cached Data' should be equivalent to this..

Edit: single player 'optimize world' didn't work

DoctorOktoberfest commented 9 months ago

This needs to urgently be fixed. I use Amulet to cut down on time terraforming the world, but it instead thanks me by erasing the light source, meaning I have to resort to manually fixing all lighting. In this case, I have encountered a lighting issue so big that It would take 3 days to potentially resolve via manually building light blocks in the world. Please consider fixing this as soon as you can. In the interim, I am highly tempted not to use this application.

MrManiac3 commented 8 months ago

This needs to urgently be fixed. I use Amulet to cut down on time terraforming the world, but it instead thanks me by erasing the light source, meaning I have to resort to manually fixing all lighting. In this case, I have encountered a lighting issue so big that It would take 3 days to potentially resolve via manually building light blocks in the world. Please consider fixing this as soon as you can. In the interim, I am highly tempted not to use this application.

The thing that brought this issue to my attention was with relocating a large building. Every opaque block that made up the building at its original location left a shadow, and manually updating the lighting by placing blocks or trying to use light blocks was only partially successful. So, I rolled the world back to the backup version I made just before trying to move things, and I haven't really used the application since. That also means I haven't been able to move things around. What I might try to do is copy structures into a final world from the original world they were constructed in, so they are never removed and the lighting is never broken. Hopefully that could be helpful for you too. Of course, this would also become a problem if you realize later that you need to make changes in the final world, and you need to make another, FINAL final world. It gets too complicated trying to work around this.

gentlegiantJGC commented 6 months ago

Looks like there was a flag in the chunk added in 1.14 that I missed that makes the chunk recalculate the lighting. The next release should fix this for Java 1.14+ worlds.

ghost commented 5 months ago

Hey just leaving this here in case anyone has the same problems I did, if you're running a server and you need to fix lighting, instead of downloading the world and doing the optimize, clear cache etc, you can add --forceUpgrade --eraseCache to the end of your startup options (NOT JVM ARGUMENTS, it should go after nogui)

For 1.19+ single player worlds, 'Edit > Optimize World > Erase Cached Data' should be equivalent to this..

Edit: single player 'optimize world' didn't work

Actually, "optimize world" of the vanilla minecraft and sodium/iris version doesn't fix this lighting issue. But when using Optifine, optimize world completely solved the incorrect lighting. I have no idea why, but if you're having problem due to lighting values not recalculated, consider installing optifine version of minecraft and then use the optimize world (including erase cache data), although optifine doesn't support up to date version of minecraft.