3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Implement remaining packets, comment out debug info.

Dieser Commit ist enthalten in:
Myles 2016-02-29 18:49:31 +00:00
Ursprung bf11edfaa9
Commit c641f02d7e
4 geänderte Dateien mit 35 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,7 @@ public class Core extends JavaPlugin {
try { try {
injectPacketHandler(); injectPacketHandler();
} catch (Exception e) { } catch (Exception e) {
System.out.println("Unable to inject handlers, this version only supports 1.8.8."); System.out.println("Unable to inject handlers, are you on 1.8?");
e.printStackTrace(); e.printStackTrace();
} }
} }

Datei anzeigen

@ -114,7 +114,7 @@ public enum PacketType {
PLAY_UPDATE_HEALTH(State.PLAY, Direction.OUTGOING, 0x06, 0x3E), PLAY_UPDATE_HEALTH(State.PLAY, Direction.OUTGOING, 0x06, 0x3E),
PLAY_SCOREBOARD_OBJ(State.PLAY, Direction.OUTGOING, 0x3B, 0x3F), PLAY_SCOREBOARD_OBJ(State.PLAY, Direction.OUTGOING, 0x3B, 0x3F),
PLAY_SET_PASSENGERS(State.PLAY, Direction.OUTGOING, -1, 0x40), PLAY_SET_PASSENGERS(State.PLAY, Direction.OUTGOING, -1, 0x40),
PLAY_TEAMS(State.PLAY, Direction.OUTGOING, 0x3E, 0x41), PLAY_TEAM(State.PLAY, Direction.OUTGOING, 0x3E, 0x41),
PLAY_UPDATE_SCORE(State.PLAY, Direction.OUTGOING, 0x3C, 0x42), PLAY_UPDATE_SCORE(State.PLAY, Direction.OUTGOING, 0x3C, 0x42),
PLAY_SPAWN_POSITION(State.PLAY, Direction.OUTGOING, 0x05, 0x43), PLAY_SPAWN_POSITION(State.PLAY, Direction.OUTGOING, 0x05, 0x43),
PLAY_TIME_UPDATE(State.PLAY, Direction.OUTGOING, 0x03, 0x44), PLAY_TIME_UPDATE(State.PLAY, Direction.OUTGOING, 0x03, 0x44),

Datei anzeigen

@ -33,9 +33,9 @@ public class IncomingTransformer {
if (packet.getPacketID() != -1) { if (packet.getPacketID() != -1) {
packetID = packet.getPacketID(); packetID = packet.getPacketID();
} }
if (packet != PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST && packet != PacketType.PLAY_KEEP_ALIVE_REQUEST && packet != PacketType.PLAY_PLAYER_POSITION_REQUEST && packet != PacketType.PLAY_PLAYER_LOOK_REQUEST) { // if (packet != PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST && packet != PacketType.PLAY_KEEP_ALIVE_REQUEST && packet != PacketType.PLAY_PLAYER_POSITION_REQUEST && packet != PacketType.PLAY_PLAYER_LOOK_REQUEST) {
System.out.println("Packet Type: " + packet + " New ID: " + packetID + " Original: " + original); // System.out.println("Packet Type: " + packet + " New ID: " + packetID + " Original: " + original);
} // }
if (packet == PacketType.PLAY_TP_CONFIRM) { if (packet == PacketType.PLAY_TP_CONFIRM) {
throw new CancelException(); throw new CancelException();
} }

Datei anzeigen

@ -45,8 +45,8 @@ public class OutgoingTransformer {
if (packet == null) { if (packet == null) {
throw new RuntimeException("Outgoing Packet not found? " + packetID + " State: " + info.getState() + " Version: " + info.getProtocol()); throw new RuntimeException("Outgoing Packet not found? " + packetID + " State: " + info.getState() + " Version: " + info.getProtocol());
} }
if (packet != PacketType.PLAY_CHUNK_DATA && packet != PacketType.PLAY_KEEP_ALIVE && packet != PacketType.PLAY_TIME_UPDATE && !packet.name().toLowerCase().contains("entity")) // if (packet != PacketType.PLAY_CHUNK_DATA && packet != PacketType.PLAY_KEEP_ALIVE && packet != PacketType.PLAY_TIME_UPDATE && !packet.name().toLowerCase().contains("entity"))
System.out.println("Packet Type: " + packet + " Original ID: " + packetID + " State:" + info.getState()); // System.out.println("Packet Type: " + packet + " Original ID: " + packetID + " State:" + info.getState());
if (packet.getPacketID() != -1) { if (packet.getPacketID() != -1) {
packetID = packet.getNewPacketID(); packetID = packet.getNewPacketID();
} }
@ -301,6 +301,33 @@ public class OutgoingTransformer {
return; return;
} }
if(packet == PacketType.PLAY_MAP) {
int damage = PacketUtil.readVarInt(input);
PacketUtil.writeVarInt(damage, output);
byte scale = input.readByte();
output.writeByte(scale);
input.readBoolean();
output.writeBytes(input);
return;
}
if(packet == PacketType.PLAY_TEAM) {
String teamName = PacketUtil.readString(input);
PacketUtil.writeString(teamName, output);
byte mode = input.readByte();
output.writeByte(mode);
if(mode == 0 || mode == 2){
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.writeString(PacketUtil.readString(input), output);
output.writeByte(input.readByte());
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.readString(input); // collission rule :)
}
output.writeBytes(input);
return;
}
if (packet == PacketType.PLAY_CHUNK_DATA) { if (packet == PacketType.PLAY_CHUNK_DATA) {
// We need to catch unloading chunk packets as defined by wiki.vg // We need to catch unloading chunk packets as defined by wiki.vg
// To unload chunks, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0) // To unload chunks, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0)