Bug Closed · Resolved

Some Functions have compatibility issues with Folia

#10029 opened by vinyl2750 1 week ago

vinyl2750reported this bug

I've found out that the functions below fail for the same reason: when a DungeonTrigger fires, the function execution is dispatched through Bukkit's global region scheduler (io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask), not through the region scheduler that owns the dungeon instance's world/chunk.

1) Block Editor Log: [23:18:44] [ERROR]: [ca.spottedleaf.moonrise.common.util.TickThread] Thread failed main thread check: Cannot modify world asynchronously, context=[thread=Folia Region Scheduler Thread #0, class=io.papermc.paper.threadedregions.TickRegionScheduler$TickThreadRunner,region={null}], world=minecraft:test_1, block_pos=BlockPos{x=4, y=-61, z=1}

Stack trace: java.lang.Throwable at ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(TickThread.java:61) at org.bukkit.craftbukkit.block.CraftBlock.setBlockState(CraftBlock.java:206) at org.bukkit.craftbukkit.block.CraftBlock.setBlockState(CraftBlock.java:200) at org.bukkit.craftbukkit.block.CraftBlock.setBlockData(CraftBlock.java:196) at org.bukkit.craftbukkit.block.CraftBlock.setType(CraftBlock.java:185) at org.bukkit.craftbukkit.block.CraftBlock.setType(CraftBlock.java:179) at net.playavalon.mythicdungeons.dungeons.functions.FunctionBlockEditor.runFunction(FunctionBlockEditor.java:100) at net.playavalon.mythicdungeons.api.parents.elements.DungeonFunction.execute(DungeonFunction.java:294) at net.playavalon.mythicdungeons.api.parents.elements.DungeonTrigger.lambda$trigger$0(DungeonTrigger.java:306) at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask.run(FoliaGlobalRegionScheduler.java:178) ... (global region scheduler tick) ...


2) Moving Block Cluster / Moving Block Log: [23:19:59] [INFO]: [MythicDungeons] ERROR :: Moving block group function in dungeon 'test' has an invalid destination! [23:19:59] [INFO]: [MythicDungeons] Function is at 4.0, -60.0, 1.0 [23:20:00] [ERROR]: [MythicDungeons] Trigger 'Dungeon Start' failed to fire: NullPointerException - Cannot invoke "org.bukkit.World.spawn(org.bukkit.Location, java.lang.Class)" because the return value of "org.bukkit.Location.getWorld()" is null


3) Item Dispenser / Key Item Dispenser Log: [23:28:49] [ERROR]: [MythicDungeons] Trigger 'Right-Click' failed to fire: NullPointerException - Cannot read field "captureDrops" because the return value of "net.minecraft.server.level.ServerLevel.getCurrentWorldData()" is null


All three reproduce consistently, every time, on a fresh Folia 26.2 server with no other Folia-related errors in the log outside of these DungeonTrigger-driven functions. There may be other function that I haven't tested yet that don't work too

Sign in to join the discussion.