Skip to content
Merged
9 changes: 8 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
== 8.4.5 ==
== 8.4.8 ==
* Protocol version 60
* Updated to Minecraft 1.5

== 8.4.7 ==
* Protocol version 51

== 8.4.6 ==
* Protocol version 49
* Forge support

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Valter Str. <>
Bryan Burke <burke.bryan@gmail.com>
Christopher Harrison <dev@ravngr.com>
Felix Wiemuth <>
Connor Tumbleson <connor.tumbleson@gmail.com>
6 changes: 3 additions & 3 deletions src/simpleserver/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
public class Main {
private static final String license = "SimpleServer -- Copyright (C) 2011 SimpleServer authors (see CONTRIBUTORS)";
private static final String warranty = "This program is licensed under The MIT License.\nSee file LICENSE for details.";
private static final String baseVersion = "8.4.7";
private static final String baseVersion = "8.4.8";
private static final boolean release = false;
private static final String releaseState = "release";
public static final int protocolVersion = 51;
public static final String minecraftVersion = "1.4.6";
public static final int protocolVersion = 60;
public static final String minecraftVersion = "1.5";
public static final String version;

static {
Expand Down
48 changes: 43 additions & 5 deletions src/simpleserver/bot/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,6 @@ protected void handlePacket(byte packetId) throws IOException {
readNBytes(16);
readUnknownBlob();
break;
case 0x15: // Pickup spawn
readNBytes(4);
readItem();
readNBytes(15);
break;
case 0x16: // Collect Item
readNBytes(8);
break;
Expand Down Expand Up @@ -478,6 +473,7 @@ protected void handlePacket(byte packetId) throws IOException {
in.readByte();
readUTF16();
in.readByte();
in.readBoolean();
break;
case 0x65: // Close Window
in.readByte();
Expand Down Expand Up @@ -570,6 +566,48 @@ protected void handlePacket(byte packetId) throws IOException {
case (byte) 0xcd: // Login & Respawn
in.readByte();
break;
case (byte) 0xce: // create scoreboard
readUTF16();
readUTF16();
in.readByte();
break;
case (byte) 0xcf: // update score
readUTF16();
byte updateRemove = in.readByte();
if (updateRemove == 0) {
readUTF16();
in.readInt();
}
break;
case (byte) 0xd0: // display scoreboard
in.readByte();
readUTF16();
break;
case (byte) 0xd1: // teams
readUTF16();
byte mode = in.readByte();
short playerCount = 0;
if (mode == 0) {
readUTF16();
readUTF16();
readUTF16();
in.readByte();
playerCount = in.readShort();
} else if (mode == 2) {
readUTF16();
readUTF16();
readUTF16();
in.readByte();
} else if (mode == 3 || mode == 4) {
playerCount = in.readShort();
}

if (playerCount != 0) {
for (int i = 0; i <= playerCount; i++) {
readUTF16();
}
}
break;
case (byte) 0xe6: // ModLoaderMP by SDK
in.readInt(); // mod
in.readInt(); // packet id
Expand Down
111 changes: 95 additions & 16 deletions src/simpleserver/stream/StreamTunnel.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,6 @@ private void handlePacket() throws IOException {
skipUnknownBlob();
}
break;
case 0x15: // Pickup Spawn
write(packetId);
copyNBytes(4);
copyItem();
copyNBytes(15);
break;
case 0x16: // Collect Item
write(packetId);
copyNBytes(8);
Expand Down Expand Up @@ -799,6 +793,18 @@ private void handlePacket() throws IOException {
write(in.readFloat());
write(in.readByte());
break;
case 0x3f: // particle
write(packetId);
write(readUTF16()); // name of particle
write(in.readFloat()); // x
write(in.readFloat()); // y
write(in.readFloat()); // z
write(in.readFloat()); // offset x
write(in.readFloat()); // offset y
write(in.readFloat()); // offset z
write(in.readFloat()); // particle speed
write(in.readInt()); // num of particles
break;
case 0x46: // New/Invalid State
write(packetId);
write(in.readByte());
Expand All @@ -814,6 +820,7 @@ private void handlePacket() throws IOException {
byte invtype = in.readByte();
String typeString = readUTF16();
byte unknownByte = in.readByte();
boolean windowTitle = in.readBoolean();
if (invtype == 0) {
Chest adjacent = server.data.chests.adjacentChest(player.openedChest());
if (!server.data.chests.isChest(player.openedChest())) {
Expand Down Expand Up @@ -860,6 +867,7 @@ private void handlePacket() throws IOException {
write(invtype);
write(typeString);
write(unknownByte);
write(windowTitle);
}
break;
case 0x65: // Close Window
Expand Down Expand Up @@ -977,6 +985,54 @@ private void handlePacket() throws IOException {
write(packetId);
write(in.readByte());
break;
case (byte) 0xce: // create scoreboard
write(readUTF16());
write(readUTF16());
write(in.readByte());
break;
case (byte) 0xcf: // update score
write(readUTF16());
byte updateRemove = in.readByte();
write(updateRemove);
if (updateRemove == 0) {
write(readUTF16());
write(in.readInt());
}
break;
case (byte) 0xd0: // display scoreboard
write(in.readByte());
write(readUTF16());
break;
case (byte) 0xd1: // teams
write(readUTF16());
byte mode = in.readByte();
short playerCount = 0;
write(mode);

if (mode == 0) { // team created
write(readUTF16()); // team display name
write(readUTF16()); // team prefix
write(readUTF16()); // team suffix
write(in.readByte()); // friendly fire
playerCount = in.readShort();
write(playerCount);
} else if (mode == 2) { // team updated
write(readUTF16());
write(readUTF16());
write(readUTF16());
write(in.readByte());
} else if (mode == 3 || mode == 4) { // team new player, team removed
playerCount = in.readShort();
write(playerCount);
}

// only ran if 0,3,4
if (playerCount != 0) {
for (int i = 0; i <= playerCount; i++) {
write(readUTF16());
}
}
break;
case (byte) 0xd3: // Red Power (mod by Eloraam)
write(packetId);
copyNBytes(1);
Expand Down Expand Up @@ -1111,6 +1167,17 @@ private void copyItem() throws IOException {
}
}

private void skipItem() throws IOException {
if (in.readShort() > 0) {
in.readByte();
in.readShort();
short length;
if ((length = in.readShort()) > 0) {
skipNBytes(length);
}
}
}

private long copyVLC() throws IOException {
long value = 0;
int shift = 0;
Expand Down Expand Up @@ -1178,11 +1245,11 @@ private void copyPlayerLook() throws IOException {
}

private void copyUnknownBlob() throws IOException {
byte unknown = in.readByte();
write(unknown);
byte item = in.readByte();
write(item);

while (unknown != 0x7f) {
int type = (unknown & 0xE0) >> 5;
while (item != 0x7f) {
int type = (item & 0xE0) >> 5;

switch (type) {
case 0:
Expand All @@ -1202,18 +1269,23 @@ private void copyUnknownBlob() throws IOException {
break;
case 5:
copyItem();
break;
case 6:
write(in.readInt());
write(in.readInt());
write(in.readInt());
}

unknown = in.readByte();
write(unknown);
item = in.readByte();
write(item);
}
}

private void skipUnknownBlob() throws IOException {
byte unknown = in.readByte();
byte item = in.readByte();

while (unknown != 0x7f) {
int type = (unknown & 0xE0) >> 5;
while (item != 0x7f) {
int type = (item & 0xE0) >> 5;

switch (type) {
case 0:
Expand All @@ -1231,9 +1303,16 @@ private void skipUnknownBlob() throws IOException {
case 4:
readUTF16();
break;
case 5:
skipItem();
break;
case 6:
in.readInt();
in.readInt();
in.readInt();
}

unknown = in.readByte();
item = in.readByte();
}
}

Expand Down