Skip to content
This repository has been archived by the owner on May 2, 2021. It is now read-only.

Commit

Permalink
конец работы над 1.4.7 (и 1.4.7 конец тоже)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashok724 committed Jan 4, 2017
1 parent 5eb4d2a commit bff1445
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 19 deletions.
40 changes: 40 additions & 0 deletions LaunchServer/resources/launchserver/defaults/profile1.4.7.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "1.4.7";
assetIndex: "---"; # 1.7.10+ only

# Runtime-dependent params
dir: "XXXXX";
assetDir: "asset1.4.7";

# Client params
sortIndex: 0;
title: "XXXXX";
serverAddress: "server.tld";
serverPort: 25565;

# Updater and client watch service
update: [
"servers\\.dat"
];
updateVerify: [
"libraries", "natives", "mods", "minecraft\\.jar"
];
updateExclusions: [];

# Client launcher params
mainClass: "net.minecraft.launchwrapper.Launch";
classPath: [ "minecraft.jar", "libraries" ];
jvmArgs: [
# Some options from Mojang's launcher
"-XX:+UseConcMarkSweepGC",
"-XX:+CMSIncrementalMode",
"-XX:-UseAdaptiveSizePolicy",
"-Xmn128M",

# JVM Attach protection
"-XX:+DisableAttachMechanism",

# Legacy bridge (for 1.6.4 & lower) settings
"-Dlauncher.legacy.skinsURL=http://skins.minecraft.net/MinecraftSkins/%username%.png",
"-Dlauncher.legacy.cloaksURL=http://skins.minecraft.net/MinecraftCloaks/%username%.png"
];
clientArgs: [];
2 changes: 1 addition & 1 deletion Launcher/source/client/ClientLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl

// Add client args
Collection<String> args = new LinkedList<>();
if (profile.getVersion().compareTo(Version.MC152) > 0) {
if (profile.getVersion().compareTo(Version.MC164) >= 0) {
addClientArgs(args, profile, params);
} else {
addClientLegacyArgs(args, profile, params);
Expand Down
1 change: 1 addition & 0 deletions Launcher/source/client/ClientProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public void verify() {

@LauncherAPI
public enum Version {
MC147("1.4.7", 51),
MC152("1.5.2", 61),
MC164("1.6.4", 78),
MC172("1.7.2", 4),
Expand Down
37 changes: 19 additions & 18 deletions Launcher/source/client/ServerPinger.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,33 @@ private Result doPing() throws IOException {
socket.connect(IOHelper.resolve(address), IOHelper.SOCKET_TIMEOUT);
try (HInput input = new HInput(socket.getInputStream());
HOutput output = new HOutput(socket.getOutputStream())) {
return version.compareTo(Version.MC172) >= 0 ?
modernPing(input, output) : legacyPing(input, output);
return version.compareTo(Version.MC172) >= 0 ? modernPing(input, output) : legacyPing(input, output, version.compareTo(Version.MC164) >= 0);
}
}
}

private Result legacyPing(HInput input, HOutput output) throws IOException {
private Result legacyPing(HInput input, HOutput output, boolean mc16) throws IOException {
output.writeUnsignedByte(0xFE); // 254 packet ID, Server list ping
output.writeUnsignedByte(0x01); // Server ping payload
output.writeUnsignedByte(0xFA); // 250 packet ID, Custom payload
writeUTF16String(output, LEGACY_PING_HOST_CHANNEL); // Custom payload name

// Prepare custom payload packet
byte[] customPayloadPacket;
try (ByteArrayOutputStream packetArray = IOHelper.newByteArrayOutput()) {
try (HOutput packetOutput = new HOutput(packetArray)) {
packetOutput.writeUnsignedByte(version.protocol); // Protocol version
writeUTF16String(packetOutput, address.getHostString()); // Server address
packetOutput.writeInt(address.getPort()); // Server port
if (mc16) {
output.writeUnsignedByte(0xFA); // 250 packet ID, Custom payload
writeUTF16String(output, LEGACY_PING_HOST_CHANNEL); // Custom payload name

// Prepare custom payload packet
byte[] customPayloadPacket;
try (ByteArrayOutputStream packetArray = IOHelper.newByteArrayOutput()) {
try (HOutput packetOutput = new HOutput(packetArray)) {
packetOutput.writeUnsignedByte(version.protocol); // Protocol version
writeUTF16String(packetOutput, address.getHostString()); // Server address
packetOutput.writeInt(address.getPort()); // Server port
}
customPayloadPacket = packetArray.toByteArray();
}
customPayloadPacket = packetArray.toByteArray();
}

// Write custom payload packet
output.writeShort((short) customPayloadPacket.length);
output.stream.write(customPayloadPacket);
// Write custom payload packet
output.writeShort((short) customPayloadPacket.length);
output.stream.write(customPayloadPacket);
}
output.flush();

// Raed kick (response) packet
Expand Down

0 comments on commit bff1445

Please sign in to comment.