mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
remove liteloader fix since liteloader is broken anyway
This commit is contained in:
parent
53be604f85
commit
375920b179
2 changed files with 0 additions and 286 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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<String> MULTI_VALUE_ARGS = ImmutableSet.<String>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<String> unqualifiedArgs = new ArrayList<String>();
|
||||
Map<String, Set<String>> qualifiedArgs = new HashMap<String, Set<String>>();
|
||||
|
||||
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<String> 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<String> unqualifiedArgs, Map<String, Set<String>> 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<String> unqualifiedArgs, Map<String, Set<String>> 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<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs)
|
||||
{
|
||||
Start.addArg(qualifiedArgs, "--tweakClass", LiteLoaderTweakerServer.class.getName());
|
||||
Start.addArg(qualifiedArgs, "--version", "mcp");
|
||||
}
|
||||
|
||||
private static LoginManager doLogin(Map<String, Set<String>> 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<String, Set<String>> qualifiedArgs, String qualifier, String arg)
|
||||
{
|
||||
Set<String> args = qualifiedArgs.get(qualifier);
|
||||
|
||||
if (args == null)
|
||||
{
|
||||
args = new HashSet<String>();
|
||||
qualifiedArgs.put(qualifier, args);
|
||||
}
|
||||
|
||||
if (!Start.MULTI_VALUE_ARGS.contains(qualifier))
|
||||
{
|
||||
args.clear();
|
||||
}
|
||||
args.add(arg);
|
||||
|
||||
}
|
||||
|
||||
private static String getArg(Map<String, Set<String>> qualifiedArgs, String arg)
|
||||
{
|
||||
if (qualifiedArgs.containsKey(arg))
|
||||
{
|
||||
return qualifiedArgs.get(arg).iterator().next();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String[] combineArgs(String[] args, List<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs)
|
||||
{
|
||||
for (Entry<String, Set<String>> qualifiedArg : qualifiedArgs.entrySet())
|
||||
{
|
||||
for (String argValue : qualifiedArg.getValue())
|
||||
{
|
||||
unqualifiedArgs.add(qualifiedArg.getKey());
|
||||
if (!Strings.isNullOrEmpty(argValue)) unqualifiedArgs.add(argValue);
|
||||
}
|
||||
}
|
||||
|
||||
return unqualifiedArgs.toArray(args);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue