Tschipcraft / dynamiclights

Burning entities/items such as torches or lanterns emit light!
https://tschipcraft.ddns.net/dynamiclights.html
Other
23 stars 1 forks source link

Stops working after some time in paper servers #45

Closed ElPiigeon closed 6 days ago

ElPiigeon commented 4 months ago

Describe the bug

The datapack works great on my 1.20.4 server hosting at my home. But, after some times, the datapack stop working and a error show on the console:

[12:28:17 WARN]: Failed to execute function dynamiclights:internal/main net.minecraft.ReportedException: Saving entity NBT at net.minecraft.world.entity.Entity.saveWithoutId(Entity.java:2505) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.world.entity.Entity.saveWithoutId(Entity.java:2344) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.advancements.critereon.NbtPredicate.getEntityTagToCompare(NbtPredicate.java:29) ~[?:?] at net.minecraft.server.commands.data.EntityDataAccessor.getData(EntityDataAccessor.java:57) ~[?:?] at net.minecraft.server.commands.data.DataCommands.manipulateData(DataCommands.java:337) ~[?:?] at net.minecraft.server.commands.data.DataCommands.lambda$decorateModification$24(DataCommands.java:219) ~[?:?] at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:31) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.commands.execution.CommandQueueEntry.a(CommandQueueEntry.java:5) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[paper-1.20.4.jar:git-Paper-496] at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:434) ~[?:?] at net.minecraft.server.ServerFunctionManager.execute(ServerFunctionManager.java:81) ~[?:?] at net.minecraft.world.level.timers.FunctionCallback.handle(FunctionCallback.java:21) ~[?:?] at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] at net.minecraft.world.level.timers.FunctionCallback.handle(FunctionCallback.java:21) ~[?:?] at net.minecraft.world.level.timers.FunctionCallback.handle(FunctionCallback.java:14) ~[?:?] at net.minecraft.world.level.timers.TimerQueue.tick(TimerQueue.ja

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

Tschipcraft commented 4 months ago

Thank you for the bug report. Paper is kind of known for accidentally breaking data pack functionality quite often due to its invasive optimization strategies. If this happens again, could you try running the command /function dynamiclights:internal/main manually and report back if that resumes Dynamic Lights?

ElPiigeon commented 4 months ago

Alright i'll keep you up

ElPiigeon commented 4 months ago

I tried /function dynamiclights:internal/main and it does nothing. Is it suppose to create a report ? I just reset the data with /function #tschipcraft:menu and it works again

Tschipcraft commented 4 months ago

Dynamic Light runs in a loop. The main function executes the code and finally reschedules itself to run on the next tick. The error you got indicates that it stopped the function midway through because of an entity NBT save error (could be caused by multi-threading?), so my hypothesis was to just resume the loop and manually 'schedule' the main function to run in the current tick. If this would have worked, I could have just moved the schedule part to the beginning of the main function so that it runs before everything else. Interesting though that the reset function worked...

ElPiigeon commented 4 months ago

hey, I just want to let you know that the "/function dynamiclights:internal/main" make the datapack works again. So everytime it stop, I just run the command and it start working again for couple hours !

Tschipcraft commented 3 months ago

Thanks for letting me know, so my first idea may work out. I will try to fix this for the next release.

Tschipcraft commented 2 months ago

I just implemented this, the dev builds are available here. If you have time, try them and let me know if this issue is fixed 🎉