Support Folia
Overview
WIP
Description
Adds support for Folia to FAWE. This requires some workarounds and fixes. We can probably also target the folia API directly, and avoid the MethodHandle stuff, but it doesn't really matter for now. For development, I used a custom Folia build to allow loading FAWE. Not sure if we can add the required field to the plugin.yml right now, as we're using the plugin-yml gradle plugin.
Note: This requires more testing and manual code inspection before integrating, there might have been changes in Folia since the last time I worked on this.
Known issues:
- [ ]
//regendoes not work
Submitter Checklist
- [x] Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [ ] New public fields and methods are annotated with
@since TODO. - [x] I read and followed the contribution guidelines.
Not sure if we can add the required field to the plugin.yml right now, as we're using the plugin-yml gradle plugin.
Only for the CLI where I added it to display an annoying message if the server attempts to load the CLI. Shouldn't be a blocker at alll.
I see, that makes things easier
https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/b2aadf97b0fb9ce8dbb9d0f81437081aa4274463/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java#L61
It needs to be replaced with a similar code supported in Folia.
Bukkit.getCurrentTick() gets the same value, but is replaced in Folia by its logic.
https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/b2aadf97b0fb9ce8dbb9d0f81437081aa4274463/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java#L61
It needs to be replaced with a similar code supported in Folia.
Bukkit.getCurrentTick()gets the same value, but is replaced in Folia by its logic.
Pleas look at my PR that extends this one
And update to 1.20 pls
@mani1232, try merge branches yourself/
[21:04:13 ERROR]: Could not pass event PlayerInteractEvent to FastAsyncWorldEdit v2.6.4-SNAPSHOT
java.lang.NoSuchFieldError: currentTick
at com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.PaperweightFaweWorldNativeAccess.
And error from 1.19.4 [19:02:47 WARN]: [FastAsyncWorldEdit] Location task for FastAsyncWorldEdit v2.6.0-SNAPSHOT in world CraftWorld{name=world} at 48, 112 generated an exception java.lang.IllegalStateException: Tile entity must be owned by current region at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:58) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedWorldData.addBlockEntityTicker(RegionizedWorldData.java:644) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at net.minecraft.world.level.Level.addBlockEntityTicker(Level.java:998) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.lambda$updateBlockEntityTicker$6(LevelChunk.java:1139) ~[?:?] at java.util.HashMap.compute(HashMap.java:1324) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.updateBlockEntityTicker(LevelChunk.java:1130) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.addAndRegisterBlockEntity(LevelChunk.java:609) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.getBlockEntity(LevelChunk.java:587) ~[?:?] at net.minecraft.world.level.Level.getBlockEntity(Level.java:1157) ~[?:?] at net.minecraft.world.level.Level.getBlockEntity(Level.java:1140) ~[?:?] at com.sk89q.worldedit.folia.adapter.impl.fawe.v1_19_R3.PaperweightGetBlocks.lambda$call$6(PaperweightGetBlocks.java:775) ~[FastAsyncWorldEdit-Bukkit-2.6.0-SNAPSHOT.jar:?] at io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler.lambda$wrap$0(FoliaRegionScheduler.java:35) ~[kaiiju-1.19.4.jar:?] at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue$ChunkBasedPriorityTask.executeInternal(RegionizedTaskQueue.java:504) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue.executeTask(RegionizedTaskQueue.java:434) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedTaskQueue$RegionTaskQueueData.drainTasks(RegionizedTaskQueue.java:263) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1517) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.TickRegions$ConcreteRegionTickHandle.tickRegion(TickRegions.java:360) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:385) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at java.lang.Thread.run(Thread.java:1589) ~[?:?]
And error from 1.19.4 [19:02:47 WARN]: [FastAsyncWorldEdit] Location task for FastAsyncWorldEdit v2.6.0-SNAPSHOT in world CraftWorld{name=world} at 48, 112 generated an exception java.lang.IllegalStateException: Tile entity must be owned by current region at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:58) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedWorldData.addBlockEntityTicker(RegionizedWorldData.java:644) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at net.minecraft.world.level.Level.addBlockEntityTicker(Level.java:998) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.lambda$updateBlockEntityTicker$6(LevelChunk.java:1139) ~[?:?] at java.util.HashMap.compute(HashMap.java:1324) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.updateBlockEntityTicker(LevelChunk.java:1130) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.addAndRegisterBlockEntity(LevelChunk.java:609) ~[?:?] at net.minecraft.world.level.chunk.LevelChunk.getBlockEntity(LevelChunk.java:587) ~[?:?] at net.minecraft.world.level.Level.getBlockEntity(Level.java:1157) ~[?:?] at net.minecraft.world.level.Level.getBlockEntity(Level.java:1140) ~[?:?] at com.sk89q.worldedit.folia.adapter.impl.fawe.v1_19_R3.PaperweightGetBlocks.lambda$call$6(PaperweightGetBlocks.java:775) ~[FastAsyncWorldEdit-Bukkit-2.6.0-SNAPSHOT.jar:?] at io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler.lambda$wrap$0(FoliaRegionScheduler.java:35) ~[kaiiju-1.19.4.jar:?] at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue$ChunkBasedPriorityTask.executeInternal(RegionizedTaskQueue.java:504) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue.executeTask(RegionizedTaskQueue.java:434) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.RegionizedTaskQueue$RegionTaskQueueData.drainTasks(RegionizedTaskQueue.java:263) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1517) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.TickRegions$ConcreteRegionTickHandle.tickRegion(TickRegions.java:360) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:385) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[kaiiju-1.19.4.jar:git-Kaiiju-"93f3978"] at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Already known issue. I will start soon some rework on it to reduce code duplication. Also there is then a tracking issue for all of those issues
And update to 1.20 pls
Here it is: https://github.com/IntellectualSites/FastAsyncWorldEdit/pull/2309 But caution: This have many issues
Please take a moment and address the merge conflicts of your pull request. Thanks!