Updated to 1.4.6

This commit is contained in:
Steveice10 2012-12-22 20:36:04 -08:00
parent c4ccc2b749
commit 69429e52a9
5 changed files with 22 additions and 10 deletions

View file

@ -2,6 +2,7 @@ package ch.spacebase.mcprotocol.net;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -131,7 +132,6 @@ public abstract class Connection {
Packet packet = protocol.getType().getPacket(opcode).newInstance();
packet.read(input);
System.out.println("Rec " + packet.getId());
if(Connection.this instanceof Client) {
packet.handleClient((Client) Connection.this);
} else {
@ -139,6 +139,8 @@ public abstract class Connection {
}
call(new PacketRecieveEvent(packet));
} catch(EOFException e) {
disconnect("End of Stream");
} catch (Exception e) {
Util.logger().severe("Error while listening to connection!");
e.printStackTrace();

View file

@ -62,7 +62,6 @@ import ch.spacebase.mcprotocol.standard.packet.PacketRespawn;
import ch.spacebase.mcprotocol.standard.packet.PacketServerPing;
import ch.spacebase.mcprotocol.standard.packet.PacketSetExperience;
import ch.spacebase.mcprotocol.standard.packet.PacketSetSlot;
import ch.spacebase.mcprotocol.standard.packet.PacketSpawnDroppedItem;
import ch.spacebase.mcprotocol.standard.packet.PacketSpawnExpOrb;
import ch.spacebase.mcprotocol.standard.packet.PacketSpawnMob;
import ch.spacebase.mcprotocol.standard.packet.PacketSpawnNamedEntity;
@ -125,7 +124,6 @@ public abstract class Protocol {
STANDARD.registerPacket(18, PacketAnimation.class);
STANDARD.registerPacket(19, PacketEntityAction.class);
STANDARD.registerPacket(20, PacketSpawnNamedEntity.class);
STANDARD.registerPacket(21, PacketSpawnDroppedItem.class);
STANDARD.registerPacket(22, PacketCollectItem.class);
STANDARD.registerPacket(23, PacketSpawnVehicle.class);
STANDARD.registerPacket(24, PacketSpawnMob.class);

View file

@ -13,10 +13,11 @@ import ch.spacebase.mcprotocol.packet.Packet;
public class PacketMapChunkBulk extends Packet {
private int columnX[];
private int columnZ[];
private int primary[];
private int add[];
public boolean skylight;
public int columnX[];
public int columnZ[];
public int primary[];
public int add[];
public byte compressed[];
public byte chunks[][];
public int length;
@ -24,11 +25,12 @@ public class PacketMapChunkBulk extends Packet {
public PacketMapChunkBulk() {
}
public PacketMapChunkBulk(int columnX[], int columnZ[], int primary[], int add[], byte data[], byte chunks[][]) {
public PacketMapChunkBulk(int columnX[], int columnZ[], int primary[], int add[], byte data[], byte chunks[][], boolean skylight) {
this.columnX = columnX;
this.columnZ = columnZ;
this.primary = primary;
this.add = add;
this.skylight = skylight;
Deflater deflater = new Deflater(-1);
@ -48,6 +50,7 @@ public class PacketMapChunkBulk extends Packet {
public void read(DataInputStream in) throws IOException {
short columns = in.readShort();
this.length = in.readInt();
this.skylight = in.readBoolean();
this.columnX = new int[columns];
this.columnZ = new int[columns];
this.primary = new int[columns];
@ -92,6 +95,7 @@ public class PacketMapChunkBulk extends Packet {
public void write(DataOutputStream out) throws IOException {
out.writeShort(this.columnX.length);
out.writeInt(this.length);
out.writeBoolean(this.skylight);
out.write(this.compressed, 0, this.length);
for(int count = 0; count < this.columnX.length; count++) {
out.writeInt(this.columnX[count]);

View file

@ -15,6 +15,8 @@ public class PacketSpawnVehicle extends Packet {
public int x;
public int y;
public int z;
public byte yaw;
public byte pitch;
public int data;
public short speedX;
public short speedY;
@ -23,12 +25,14 @@ public class PacketSpawnVehicle extends Packet {
public PacketSpawnVehicle() {
}
public PacketSpawnVehicle(int entityId, byte type, int x, int y, int z, int data, short speedX, short speedY, short speedZ) {
public PacketSpawnVehicle(int entityId, byte type, int x, int y, int z, byte yaw, byte pitch, int data, short speedX, short speedY, short speedZ) {
this.entityId = entityId;
this.type = type;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.data = data;
this.speedX = speedX;
this.speedY = speedY;
@ -42,6 +46,8 @@ public class PacketSpawnVehicle extends Packet {
this.x = in.readInt();
this.y = in.readInt();
this.z = in.readInt();
this.yaw = in.readByte();
this.pitch = in.readByte();
this.data = in.readInt();
if(this.data > 0) {
this.speedX = in.readShort();
@ -57,6 +63,8 @@ public class PacketSpawnVehicle extends Packet {
out.writeInt(this.x);
out.writeInt(this.y);
out.writeInt(this.z);
out.writeByte(this.yaw);
out.writeByte(this.pitch);
out.writeInt(this.data);
if(this.data > 0) {
out.writeShort(this.speedX);

View file

@ -3,7 +3,7 @@ package ch.spacebase.mcprotocol.util;
public class Constants {
public static final int LAUNCHER_VERSION = 13;
public static final byte STANDARD_PROTOCOL_VERSION = 49;
public static final byte STANDARD_PROTOCOL_VERSION = 51;
public static final byte CLASSIC_PROTOCOL_VERSION = 7;
public static final byte[] POCKET_MAGIC = new byte[] { 0, -1, -1, 0, -2, -2, -2, -2, -3, -3, -3, -3, 18, 52, 86, 120 };