Get multiplayer to work again
This commit is contained in:
parent
76bbc59388
commit
0b6b1b618b
9 changed files with 25 additions and 37 deletions
|
@ -42,7 +42,7 @@ dependencies {
|
|||
provided ("org.lwjgl.lwjgl:lwjgl:2.9.3")
|
||||
provided ("org.lwjgl.lwjgl:lwjgl_util:2.9.3")
|
||||
provided ("org.lwjgl.lwjgl:lwjgl-platform:2.9.3")
|
||||
provided ("dev.zontreck:LibAC:1.4.14")
|
||||
provided ("dev.zontreck:LibAC:1.4.15")
|
||||
}
|
||||
|
||||
// Apply a specific Java toolchain to ease working on different environments.
|
||||
|
|
|
@ -270,13 +270,13 @@ public final class SocketConnection {
|
|||
|
||||
}
|
||||
|
||||
public final void sendPacket(Packet var1, Object... var2) {
|
||||
public final void sendPacket(Packet packetType, Object... args) {
|
||||
if(this.connected) {
|
||||
this.writeBuffer.put(var1.id);
|
||||
this.writeBuffer.put(packetType.id);
|
||||
|
||||
for(int var3 = 0; var3 < var2.length; ++var3) {
|
||||
Class var10001 = var1.fields[var3];
|
||||
Object var6 = var2[var3];
|
||||
for(int i = 0; i < args.length; ++i) {
|
||||
Class var10001 = packetType.fields[i];
|
||||
Object var6 = args[i];
|
||||
Class var5 = var10001;
|
||||
SocketConnection var4 = this;
|
||||
if(this.connected) {
|
||||
|
|
|
@ -1227,7 +1227,7 @@ public final class Minecraft implements Runnable {
|
|||
.withContentType("application/x-www-form-urlencoded")
|
||||
.withMethod(HTTPMethod.POST)
|
||||
.withBody("id=" + serverArg.getValue() +
|
||||
"&username=" + minecraft.user)
|
||||
"&username=" + minecraft.user.name)
|
||||
.build();
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println("An error occured: " + e.getMessage());
|
||||
|
@ -1240,6 +1240,7 @@ public final class Minecraft implements Runnable {
|
|||
String[] lReply = response.getResponseBody().split(";");
|
||||
minecraft.server = lReply[0];
|
||||
minecraft.port = Integer.parseInt(lReply[1]);
|
||||
minecraft.user.mpPass = lReply[2];
|
||||
}else {
|
||||
System.out.println("Server could not be found!\nID: " + serverArg.getValue()+ "\nHTTP Response: " + response.getResponseBody());
|
||||
return;
|
||||
|
|
|
@ -13,10 +13,10 @@ public final class ConnectionManager {
|
|||
public boolean processData = false;
|
||||
public HashMap players = new HashMap();
|
||||
|
||||
public ConnectionManager(Minecraft var1, String var2, int var3, String var4, String var5) {
|
||||
var1.hideGui = true;
|
||||
this.minecraft = var1;
|
||||
(new ConnectionThread(this, var2, var3, var4, var5, var1)).start();
|
||||
public ConnectionManager(Minecraft instance, String server, int port, String username, String mpass) {
|
||||
instance.hideGui = true;
|
||||
this.minecraft = instance;
|
||||
(new ConnectionThread(this, server, port, username, mpass, instance)).start();
|
||||
}
|
||||
|
||||
public final void sendBlockChange(int var1, int var2, int var3, int var4, int var5) {
|
||||
|
|
|
@ -13,13 +13,13 @@ final class ConnectionThread extends Thread {
|
|||
private Minecraft minecraft;
|
||||
private ConnectionManager connectionManager;
|
||||
|
||||
ConnectionThread(ConnectionManager var1, String var2, int var3, String var4, String var5, Minecraft var6) {
|
||||
this.connectionManager = var1;
|
||||
this.ip = var2;
|
||||
this.port = var3;
|
||||
this.username = var4;
|
||||
this.mpPass = var5;
|
||||
this.minecraft = var6;
|
||||
ConnectionThread(ConnectionManager instance, String server, int port, String username, String mpass, Minecraft game) {
|
||||
this.connectionManager = instance;
|
||||
this.ip = server;
|
||||
this.port = port;
|
||||
this.username = username;
|
||||
this.mpPass = mpass;
|
||||
this.minecraft = game;
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
|
|
|
@ -145,7 +145,7 @@ public class NetworkPlayer extends Entity {
|
|||
var2 = 0.05F;
|
||||
GL11.glScalef(var2, -var2, var2);
|
||||
GL11.glTranslatef((float)(-var9.width(this.name)) / 2.0F, 0.0F, 0.0F);
|
||||
if(this.name.equalsIgnoreCase("Notch")) {
|
||||
if(this.name.equalsIgnoreCase("zontreck")) {
|
||||
var9.draw(this.name, 0, 0, 16776960);
|
||||
} else {
|
||||
var9.draw(this.name, 0, 0, 16777215);
|
||||
|
|
|
@ -37,7 +37,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
provided ("dev.zontreck:LibAC:1.4.14")
|
||||
provided ("dev.zontreck:LibAC:1.4.15")
|
||||
}
|
||||
|
||||
// Apply a specific Java toolchain to ease working on different environments.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.mojang.minecraft.server;
|
||||
|
||||
import dev.zontreck.ariaslib.util.Hashing;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -11,14 +13,7 @@ public final class MPPassCalculator {
|
|||
this.salt = var1;
|
||||
}
|
||||
|
||||
public final String calcMPass(String var1) {
|
||||
try {
|
||||
String var3 = this.salt + var1;
|
||||
MessageDigest var4 = MessageDigest.getInstance("MD5");
|
||||
var4.update(var3.getBytes(), 0, var3.length());
|
||||
return (new BigInteger(1, var4.digest())).toString(16);
|
||||
} catch (NoSuchAlgorithmException var2) {
|
||||
throw new RuntimeException(var2);
|
||||
}
|
||||
public final String calcMPass(String username) {
|
||||
return Hashing.md5(this.salt + username);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,15 +53,7 @@ public final class PlayerInstance {
|
|||
return var10000.append(var1.ip).append(")").toString();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
! 04:58:40 /192.168.1.1:java.nio.BufferUnderflowException
|
||||
! 04:58:40 Exception handling /192.168.1.1!
|
||||
! 04:58:40 /192.168.1.1:java.lang.NullPointerException
|
||||
! 04:58:40 Exception handling /192.168.1.1!
|
||||
04:58:40 /192.168.1.1 disconnected
|
||||
*/
|
||||
public final void handlePackets(Packet var1, Object[] var2) {
|
||||
if(var1 == Packet.LOGIN) {
|
||||
byte var12 = ((Byte)var2[0]).byteValue();
|
||||
|
|
Loading…
Reference in a new issue