Update to Minecraft 1.6.1

This commit is contained in:
md_5 2013-07-01 13:19:18 +10:00
parent a9603a6372
commit 1296783d9b
8 changed files with 97 additions and 12 deletions

View File

@ -3,5 +3,5 @@ package net.md_5.bungee.protocol;
public enum OpCode public enum OpCode
{ {
BOOLEAN, BULK_CHUNK, BYTE, BYTE_INT, DOUBLE, FLOAT, INT, INT_3, INT_BYTE, ITEM, LONG, METADATA, OPTIONAL_MOTION, SHORT, SHORT_BYTE, SHORT_ITEM, STRING, USHORT_BYTE BOOLEAN, BULK_CHUNK, BYTE, BYTE_INT, DOUBLE, FLOAT, INT, INT_3, INT_BYTE, ITEM, LONG, METADATA, OPTIONAL_MOTION, SHORT, SHORT_BYTE, SHORT_ITEM, STRING, USHORT_BYTE, OPTIONAL_WINDOW
} }

View File

@ -1,7 +1,6 @@
package net.md_5.bungee.protocol; package net.md_5.bungee.protocol;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import lombok.Getter; import lombok.Getter;
@ -9,6 +8,7 @@ import static net.md_5.bungee.protocol.OpCode.*;
import net.md_5.bungee.protocol.packet.DefinedPacket; import net.md_5.bungee.protocol.packet.DefinedPacket;
import net.md_5.bungee.protocol.packet.Packet0KeepAlive; import net.md_5.bungee.protocol.packet.Packet0KeepAlive;
import net.md_5.bungee.protocol.packet.Packet1Login; import net.md_5.bungee.protocol.packet.Packet1Login;
import net.md_5.bungee.protocol.packet.Packet2CEntityProperties;
import net.md_5.bungee.protocol.packet.Packet2Handshake; import net.md_5.bungee.protocol.packet.Packet2Handshake;
import net.md_5.bungee.protocol.packet.Packet3Chat; import net.md_5.bungee.protocol.packet.Packet3Chat;
import net.md_5.bungee.protocol.packet.Packet9Respawn; import net.md_5.bungee.protocol.packet.Packet9Respawn;
@ -29,8 +29,8 @@ import net.md_5.bungee.protocol.skip.PacketReader;
public class Vanilla implements Protocol public class Vanilla implements Protocol
{ {
public static final byte PROTOCOL_VERSION = 61; public static final byte PROTOCOL_VERSION = 73;
public static final String GAME_VERSION = "1.5.2"; public static final String GAME_VERSION = "1.6.1";
@Getter @Getter
private static final Vanilla instance = new Vanilla(); private static final Vanilla instance = new Vanilla();
/*========================================================================*/ /*========================================================================*/
@ -54,6 +54,7 @@ public class Vanilla implements Protocol
classes[0x03] = Packet3Chat.class; classes[0x03] = Packet3Chat.class;
classes[0x09] = Packet9Respawn.class; classes[0x09] = Packet9Respawn.class;
classes[0xC9] = PacketC9PlayerListItem.class; classes[0xC9] = PacketC9PlayerListItem.class;
classes[0x2C] = Packet2CEntityProperties.class;
classes[0xCC] = PacketCCSettings.class; classes[0xCC] = PacketCCSettings.class;
classes[0xCD] = PacketCDClientStatus.class; classes[0xCD] = PacketCDClientStatus.class;
classes[0xCE] = PacketCEScoreboardObjective.class; classes[0xCE] = PacketCEScoreboardObjective.class;
@ -141,7 +142,7 @@ public class Vanilla implements Protocol
}; };
opCodes[0x08] = new OpCode[] opCodes[0x08] = new OpCode[]
{ {
SHORT, SHORT, FLOAT FLOAT, SHORT, FLOAT
}; };
opCodes[0x0A] = new OpCode[] opCodes[0x0A] = new OpCode[]
{ {
@ -181,7 +182,7 @@ public class Vanilla implements Protocol
}; };
opCodes[0x13] = new OpCode[] opCodes[0x13] = new OpCode[]
{ {
INT, BYTE INT, BYTE, INT
}; };
opCodes[0x14] = new OpCode[] opCodes[0x14] = new OpCode[]
{ {
@ -207,6 +208,10 @@ public class Vanilla implements Protocol
{ {
INT, INT, INT, INT, SHORT INT, INT, INT, INT, SHORT
}; };
opCodes[0x1B] = new OpCode[]
{
FLOAT, FLOAT, BOOLEAN, BOOLEAN
};
opCodes[0x1C] = new OpCode[] opCodes[0x1C] = new OpCode[]
{ {
INT, SHORT, SHORT, SHORT INT, SHORT, SHORT, SHORT
@ -245,7 +250,7 @@ public class Vanilla implements Protocol
}; };
opCodes[0x27] = new OpCode[] opCodes[0x27] = new OpCode[]
{ {
INT, INT INT, INT, BOOLEAN
}; };
opCodes[0x28] = new OpCode[] opCodes[0x28] = new OpCode[]
{ {
@ -313,7 +318,7 @@ public class Vanilla implements Protocol
}; };
opCodes[0x64] = new OpCode[] opCodes[0x64] = new OpCode[]
{ {
BYTE, BYTE, STRING, BYTE, BOOLEAN OPTIONAL_WINDOW
}; };
opCodes[0x65] = new OpCode[] opCodes[0x65] = new OpCode[]
{ {
@ -365,11 +370,11 @@ public class Vanilla implements Protocol
}; };
opCodes[0xC8] = new OpCode[] opCodes[0xC8] = new OpCode[]
{ {
INT, BYTE INT, INT
}; };
opCodes[0xCA] = new OpCode[] opCodes[0xCA] = new OpCode[]
{ {
BYTE, BYTE, BYTE BYTE, FLOAT, FLOAT
}; };
opCodes[0xCB] = new OpCode[] opCodes[0xCB] = new OpCode[]
{ {

View File

@ -23,6 +23,10 @@ public abstract class AbstractPacketHandler
{ {
} }
public void handle(Packet2CEntityProperties properties) throws Exception
{
}
public void handle(PacketC9PlayerListItem playerList) throws Exception public void handle(PacketC9PlayerListItem playerList) throws Exception
{ {
} }

View File

@ -0,0 +1,52 @@
package net.md_5.bungee.protocol.packet;
import io.netty.buffer.ByteBuf;
import java.util.HashMap;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@ToString
@EqualsAndHashCode(callSuper = false)
public class Packet2CEntityProperties extends DefinedPacket
{
private int entityId;
private Map<String, Double> data = new HashMap<>();
public Packet2CEntityProperties()
{
super( 0x2C );
}
@Override
public void read(ByteBuf buf)
{
entityId = buf.readInt();
int recordCount = buf.readInt();
for ( int i = 0; i < recordCount; i++ )
{
data.put( readString( buf ), buf.readDouble() );
}
}
@Override
public void write(ByteBuf buf)
{
buf.writeInt( entityId );
buf.writeInt( data.size() );
for ( Map.Entry<String, Double> entry : data.entrySet() )
{
writeString( entry.getKey(), buf );
buf.writeDouble( entry.getValue() );
}
}
@Override
public void handle(AbstractPacketHandler handler) throws Exception
{
handler.handle( this );
}
}

View File

@ -23,6 +23,7 @@ abstract class Instruction
static final Instruction SHORT_ITEM = new ShortHeader( ITEM ); static final Instruction SHORT_ITEM = new ShortHeader( ITEM );
static final Instruction STRING = new ShortHeader( new Jump( 2 ) ); static final Instruction STRING = new ShortHeader( new Jump( 2 ) );
static final Instruction USHORT_BYTE = new UnsignedShortByte(); static final Instruction USHORT_BYTE = new UnsignedShortByte();
static final Instruction OPTIONAL_WINDOW = new OptionalWindow();
// Illegal forward references below this line // Illegal forward references below this line
static final Instruction BYTE_INT = new ByteHeader( INT ); static final Instruction BYTE_INT = new ByteHeader( INT );
// Custom instructions // Custom instructions

View File

@ -0,0 +1,21 @@
package net.md_5.bungee.protocol.skip;
import io.netty.buffer.ByteBuf;
public class OptionalWindow extends Instruction
{
@Override
void read(ByteBuf in)
{
BYTE.read( in );
byte type = in.readByte();
STRING.read( in );
BYTE.read( in );
BOOLEAN.read( in );
if ( type == 11 )
{
INT.read( in );
}
}
}

View File

@ -487,7 +487,8 @@ public class BungeeCord extends ProxyServer
public void broadcast(String message) public void broadcast(String message)
{ {
getConsole().sendMessage( message ); getConsole().sendMessage( message );
broadcast( new Packet3Chat( message ) ); // TODO: Here too
broadcast( new Packet3Chat( "{\"text\":\"" + message + "\"}" ));
} }
public void addConnection(UserConnection con) public void addConnection(UserConnection con)

View File

@ -265,7 +265,8 @@ public final class UserConnection implements ProxiedPlayer
@Override @Override
public void sendMessage(String message) public void sendMessage(String message)
{ {
unsafe().sendPacket( new Packet3Chat( message ) ); // TODO: Fix this
unsafe().sendPacket( new Packet3Chat( "{\"text\":\"" + message + "\"}" ) );
} }
@Override @Override