Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to protocol version 23 (Minecraft 1.1) (Fixes issue #220)

* Add level-type option (as levelType in simpleserver.properties)
  • Loading branch information...
commit 35b797f656b84523bf9698067473ded21947bbd6 1 parent f7a512a
@bryanburke bryanburke authored
View
12 src/simpleserver/bot/Bot.java
@@ -38,7 +38,7 @@
import simpleserver.Server;
public class Bot {
- private static final int VERSION = 22;
+ private static final int VERSION = 23;
protected String name;
protected Server server;
@@ -119,6 +119,7 @@ protected void login() throws IOException {
out.writeInt(VERSION);
write(name);
out.writeLong(0);
+ write(readUTF16()); // Added in 1.1 (level type)
out.writeInt(0);
out.writeByte(0);
out.writeByte(0);
@@ -134,6 +135,7 @@ private void respawn() throws IOException {
out.writeByte(0);
out.writeShort(128);
out.writeLong(0);
+ write(readUTF16()); // Added in 1.1 (level type)
writeLock.unlock();
}
@@ -340,9 +342,6 @@ protected void handlePacket(byte packetId) throws IOException {
in.readInt();
in.readShort();
break;
- case 0x1b: // ???
- readNBytes(18);
- break;
case 0x1c: // Entity Velocity?
readNBytes(10);
break;
@@ -509,6 +508,11 @@ protected void handlePacket(byte packetId) throws IOException {
readNBytes(in.readInt());
}
break;
+ case (byte) 0xfa: // Unknown, added in 1.1
+ readUTF16();
+ short arrayLength = in.readShort();
+ readNBytes(0xff & arrayLength);
+ break;
case (byte) 0xfe:
break;
default:
View
1  src/simpleserver/options/MinecraftOptions.java
@@ -41,6 +41,7 @@ public void save() {
options.setProperty("difficulty", simpleServerOptions.get("difficulty"));
options.setProperty("max-players", "1024");
options.setProperty("level-name", simpleServerOptions.get("levelName"));
+ options.setProperty("level-type", simpleServerOptions.get("levelType"));
options.setProperty("spawn-animals", simpleServerOptions.get("spawnAnimals"));
options.setProperty("spawn-monsters", simpleServerOptions.get("spawnMonsters"));
options.setProperty("allow-flight", simpleServerOptions.get("allowFlight"));
View
1  src/simpleserver/options/defaults/simpleserver.properties
@@ -12,6 +12,7 @@ internalPort=25566
ipAddress=0.0.0.0
javaArguments=
levelName=world
+levelType=DEFAULT
memory=1024
overwriteArguments=false
port=25565
View
13 src/simpleserver/stream/StreamTunnel.java
@@ -193,6 +193,7 @@ private void handlePacket() throws IOException {
write(in.readLong());
}
+ write(readUTF16()); // added in 1.1 (level type)
write(in.readInt());
dimension = in.readByte();
@@ -364,6 +365,7 @@ private void handlePacket() throws IOException {
write(in.readByte());
write(in.readShort());
write(in.readLong());
+ write(readUTF16()); // Added in 1.1 (level type)
break;
case 0x0a: // Player
write(packetId);
@@ -649,10 +651,6 @@ private void handlePacket() throws IOException {
write(in.readInt());
write(in.readShort());
break;
- case 0x1b: // ???
- write(packetId);
- copyNBytes(18);
- break;
case 0x1c: // Entity Velocity?
write(packetId);
copyNBytes(10);
@@ -934,6 +932,13 @@ private void handlePacket() throws IOException {
copyNBytes(write(in.readInt()));
}
break;
+ case (byte) 0xfa:
+ write(packetId);
+ write(readUTF16());
+ short arrayLength = in.readShort();
+ write(arrayLength);
+ copyNBytes(0xff & arrayLength);
+ break;
case (byte) 0xfe: // 1.8, poll server status (254)
write(packetId);
break;
Please sign in to comment.
Something went wrong with that request. Please try again.