diff --git a/src/main/java/club/mcams/carpetpatcher/mixins/fakePlayerCrashing/EntityPlayerMPFakeMixin.java b/src/main/java/club/mcams/carpetpatcher/mixins/fakePlayerCrashing/EntityPlayerMPFakeMixin.java index ca9c413..16d3181 100644 --- a/src/main/java/club/mcams/carpetpatcher/mixins/fakePlayerCrashing/EntityPlayerMPFakeMixin.java +++ b/src/main/java/club/mcams/carpetpatcher/mixins/fakePlayerCrashing/EntityPlayerMPFakeMixin.java @@ -21,9 +21,50 @@ package club.mcams.carpetpatcher.mixins.fakePlayerCrashing; import carpet.patches.EntityPlayerMPFake; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import com.mojang.authlib.GameProfile; +import net.minecraft.server.MinecraftServer; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; @Mixin(value = EntityPlayerMPFake.class, remap = false) public class EntityPlayerMPFakeMixin { - +// @WrapMethod( +// method = "createFake" +// ) +// private static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, DimensionType dimension, GameMode gamemode, Operation original) { +// try { +// CompletableFuture future = CompletableFuture.supplyAsync(() -> original.call(username, server, d0, d1, d2, yaw, pitch, dimension, gamemode), server); +// return future.get(); +// } catch (InterruptedException | ExecutionException e) { +// // 异常处理 +// e.printStackTrace(); +// // 根据需求返回默认值或其他处理 +// return null; +// } +// } +// +// @WrapOperation( +// method = "createFake", +// +// ) + //上面的先不管,优先处理会崩服的 + //#if MC>=12002 && MC<=12004 + //$$ @WrapOperation( + //$$ method = "createFake", + //$$ at = @At( + //$$ value = "INVOKE", + //$$ target = "Ljava/util/concurrent/CompletableFuture;thenAccept(Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;" + //$$ ) + //$$ ) + //$$ private static CompletableFuture createFake(CompletableFuture> instance, Consumer> action, Operation> original, @Local(argsOnly = true) MinecraftServer server) { + //$$ return instance.thenAcceptAsync(action, server); + //$$ } + //#endif }