From e89e5c1a6f82c96ed683eddedb62fe002baf3ad3 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Tue, 6 Jun 2023 10:47:38 +0200 Subject: [PATCH] Implements method handles for folia --- .../PaperweightFaweWorldNativeAccess.java | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java index 866c6b559..41659efeb 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java @@ -5,6 +5,7 @@ import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.task.RunnableVal; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R3.PaperweightAdapter; import com.sk89q.worldedit.internal.block.BlockStateIdAccess; import com.sk89q.worldedit.internal.wna.WorldNativeAccess; import com.sk89q.worldedit.util.SideEffect; @@ -26,6 +27,8 @@ import org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData; import org.bukkit.event.block.BlockPhysicsEvent; import javax.annotation.Nullable; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; import java.lang.ref.WeakReference; import java.util.Collections; import java.util.HashSet; @@ -51,6 +54,10 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess cachedChanges = new HashSet<>(); private final Set cachedChunksToSend = new HashSet<>(); + private final MethodHandle globalTickData; + private final Class regionScheduleHandleClass; + private final Class regionizedServerClass; + private final MethodHandle globalCurrentTick; private SideEffectSet sideEffectSet; public PaperweightFaweWorldNativeAccess(PaperweightFaweAdapter paperweightFaweAdapter, WeakReference level) { @@ -58,7 +65,30 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess currentTick; @@ -110,6 +151,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess