From 375920b179d8b111cb77614cfa300a82ae6f0caf Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 1 Mar 2016 00:40:11 -0500 Subject: [PATCH] remove liteloader fix since liteloader is broken anyway --- .../mixin/MixinNetHandlerPlayServer.java | 93 --------- .../com/mumfrey/liteloader/debug/Start.java | 193 ------------------ 2 files changed, 286 deletions(-) delete mode 100644 src/api/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java delete mode 100644 src/api/java/com/mumfrey/liteloader/debug/Start.java diff --git a/src/api/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java b/src/api/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java deleted file mode 100644 index 4e18e214..00000000 --- a/src/api/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.mumfrey.liteloader.common.mixin; - - -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Surrogate; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import com.mumfrey.liteloader.core.Proxy; - -import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.network.play.client.C03PacketPlayer; -import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; -import net.minecraft.network.play.client.C0APacketAnimation; -import net.minecraft.world.WorldServer; - -@Mixin(NetHandlerPlayServer.class) -public abstract class MixinNetHandlerPlayServer -{ - @Inject( - method = "processPlayerBlockPlacement(Lnet/minecraft/network/play/client/C08PacketPlayerBlockPlacement;)V", - cancellable = true, - at = @At( - value = "INVOKE", - shift = Shift.AFTER, - target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue" - + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V" - ) - ) - private void onPlaceBlock(C08PacketPlayerBlockPlacement packetIn, CallbackInfo ci) - { - Proxy.onPlaceBlock(ci, (NetHandlerPlayServer)(Object)this, packetIn); - } - - @Inject( - method = "handleAnimation(Lnet/minecraft/network/play/client/C0APacketAnimation;)V", - cancellable = true, - at = @At( - value = "INVOKE", - shift = Shift.AFTER, - target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue" - + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V" - ) - ) - private void onClickedAir(C0APacketAnimation packetIn, CallbackInfo ci) - { - Proxy.onClickedAir(ci, (NetHandlerPlayServer)(Object)this, packetIn); - } - - @Inject( - method = "processPlayerDigging(Lnet/minecraft/network/play/client/C07PacketPlayerDigging;)V", - cancellable = true, - at = @At( - value = "INVOKE", - shift = Shift.AFTER, - target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue" - + "(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V" - ) - ) - private void onPlayerDigging(C07PacketPlayerDigging packetIn, CallbackInfo ci) - { - Proxy.onPlayerDigging(ci, (NetHandlerPlayServer)(Object)this, packetIn); - } - - @Inject( - method = "processPlayer(Lnet/minecraft/network/play/client/C03PacketPlayer;)V", - cancellable = true, - locals = LocalCapture.CAPTURE_FAILHARD, - at = @At( - value = "FIELD", - opcode = Opcodes.GETFIELD, - // XXX fix - target = "Lnet/minecraft/entity/Entity;posY:D", - ordinal = 4 - ) - ) - private void onPlayerMoved(C03PacketPlayer packetIn, CallbackInfo ci, WorldServer world, double oldPosX, double oldPosY, double oldPosZ, - double deltaMoveSq, double deltaX, double deltaY, double deltaZ) - { - Proxy.onPlayerMoved(ci, (NetHandlerPlayServer)(Object)this, packetIn, world, oldPosX, oldPosY, oldPosZ, deltaMoveSq, deltaX, deltaY, deltaZ); - } - - @Surrogate - private void onPlayerMoved(C03PacketPlayer packetIn, CallbackInfo ci, WorldServer world, double oldPosX, double oldPosY, double oldPosZ) - { - Proxy.onPlayerMoved(ci, (NetHandlerPlayServer)(Object)this, packetIn, world, oldPosX, oldPosY, oldPosZ); - } -} diff --git a/src/api/java/com/mumfrey/liteloader/debug/Start.java b/src/api/java/com/mumfrey/liteloader/debug/Start.java deleted file mode 100644 index 402ca372..00000000 --- a/src/api/java/com/mumfrey/liteloader/debug/Start.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.mumfrey.liteloader.debug; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableSet; -import com.mumfrey.liteloader.launch.LiteLoaderTweaker; -import com.mumfrey.liteloader.launch.LiteLoaderTweakerServer; -import com.mumfrey.liteloader.util.log.LiteLoaderLogger; - -import net.minecraft.launchwrapper.Launch; - -/** - * Wrapper class for LaunchWrapper Main class, which logs in using Yggdrasil - * first so that online shizzle can be tested. - * - * @author Adam Mummery-Smith - */ -public abstract class Start -{ - /** - * Number of times to retry Yggdrasil login - */ - private static final int LOGIN_RETRIES = 5; - - /** - * Arguments which are allowed to have multiple occurrences - */ - private static final Set MULTI_VALUE_ARGS = ImmutableSet.of( - "--tweakClass" - ); - - /** - * Entry point. - * - * @param args - */ - public static void main(String[] args) - { - System.setProperty("mcpenv", "true"); - Launch.main(Start.processArgs(args)); - } - - /** - * Process the launch-time args, since we may be being launched by - * GradleStart we need to parse out any values passed in and ensure we - * replace them with our own. - */ - private static String[] processArgs(String[] args) - { - List unqualifiedArgs = new ArrayList(); - Map> qualifiedArgs = new HashMap>(); - - Start.parseArgs(args, unqualifiedArgs, qualifiedArgs); - - if (Start.hasArg(unqualifiedArgs, "server")) - { - Start.addRequiredArgsServer(args, unqualifiedArgs, qualifiedArgs); - } - else - { - Start.addRequiredArgsClient(args, unqualifiedArgs, qualifiedArgs); - } - - args = Start.combineArgs(args, unqualifiedArgs, qualifiedArgs); - return args; - } - - private static boolean hasArg(List args, String target) - { - for (String arg : args) - { - if (target.equalsIgnoreCase(arg)) - { - return true; - } - } - - return false; - } - - /** - * Read the args from the command line into the qualified and unqualified - * collections. - */ - private static void parseArgs(String[] args, List unqualifiedArgs, Map> qualifiedArgs) - { - String qualifier = null; - for (String arg : args) - { - boolean isQualifier = arg.startsWith("-"); - - if (isQualifier) - { - if (qualifier != null) unqualifiedArgs.add(qualifier); - qualifier = arg; - } - else if (qualifier != null) - { - Start.addArg(qualifiedArgs, qualifier, arg); - qualifier = null; - } - else - { - unqualifiedArgs.add(arg); - } - } - - if (qualifier != null) unqualifiedArgs.add(qualifier); - } - - private static void addRequiredArgsClient(String[] args, List unqualifiedArgs, Map> qualifiedArgs) - { - LoginManager loginManager = Start.doLogin(qualifiedArgs); - // XXX gradle Fix - Start.addArg(qualifiedArgs, "--tweakClass", LiteLoaderTweaker.class.getName()); - Start.addArg(qualifiedArgs, "--username", loginManager.getProfileName()); - Start.addArg(qualifiedArgs, "--uuid", loginManager.getUUID()); - Start.addArg(qualifiedArgs, "--accessToken", loginManager.getAuthenticatedToken()); - Start.addArg(qualifiedArgs, "--userType", loginManager.getUserType()); - Start.addArg(qualifiedArgs, "--userProperties", loginManager.getUserProperties()); - } - - private static void addRequiredArgsServer(String[] args, List unqualifiedArgs, Map> qualifiedArgs) - { - Start.addArg(qualifiedArgs, "--tweakClass", LiteLoaderTweakerServer.class.getName()); - Start.addArg(qualifiedArgs, "--version", "mcp"); - } - - private static LoginManager doLogin(Map> qualifiedArgs) - { - File loginJson = new File(new File(System.getProperty("user.dir")), ".auth.json"); - LoginManager loginManager = new LoginManager(loginJson); - - String usernameFromCmdLine = Start.getArg(qualifiedArgs, "--username"); - String passwordFromCmdLine = Start.getArg(qualifiedArgs, "--password"); - - loginManager.login(usernameFromCmdLine, passwordFromCmdLine, Start.LOGIN_RETRIES); - - LiteLoaderLogger.info("Launching game as %s", loginManager.getProfileName()); - - return loginManager; - } - - private static void addArg(Map> qualifiedArgs, String qualifier, String arg) - { - Set args = qualifiedArgs.get(qualifier); - - if (args == null) - { - args = new HashSet(); - qualifiedArgs.put(qualifier, args); - } - - if (!Start.MULTI_VALUE_ARGS.contains(qualifier)) - { - args.clear(); - } - args.add(arg); - - } - - private static String getArg(Map> qualifiedArgs, String arg) - { - if (qualifiedArgs.containsKey(arg)) - { - return qualifiedArgs.get(arg).iterator().next(); - } - - return null; - } - - private static String[] combineArgs(String[] args, List unqualifiedArgs, Map> qualifiedArgs) - { - for (Entry> qualifiedArg : qualifiedArgs.entrySet()) - { - for (String argValue : qualifiedArg.getValue()) - { - unqualifiedArgs.add(qualifiedArg.getKey()); - if (!Strings.isNullOrEmpty(argValue)) unqualifiedArgs.add(argValue); - } - } - - return unqualifiedArgs.toArray(args); - } -}