3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-07-03 22:18:04 +02:00

Code Cleanup, remove some of the output debug (Packet debug is still there)

Dieser Commit ist enthalten in:
Myles 2016-02-29 13:26:06 +00:00
Ursprung 3fa4b7a7b2
Commit 1a1ffe4265
2 geänderte Dateien mit 7 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -42,17 +42,14 @@ public class IncomingTransformer {
System.out.println("Packet Type: " + packet + " New ID: " + packetID + " Original: " + original);
}
if (packet == PacketType.PLAY_TP_CONFIRM) {
System.out.println("Cancelling TP Confirm");
throw new CancelException();
}
PacketUtil.writeVarInt(packetID, output);
if (packet == PacketType.HANDSHAKE) {
System.out.println("Readable Bytes: " + input.readableBytes());
int protVer = PacketUtil.readVarInt(input);
info.setProtocol(protVer);
PacketUtil.writeVarInt(protVer <= 102 ? protVer : 47, output); // pretend to be older
System.out.println("Incoming prot ver: " + protVer);
if (protVer <= 102) {
// Not 1.9 remove pipes
this.init.remove();
@ -137,13 +134,11 @@ public class IncomingTransformer {
short skinParts = input.readUnsignedByte();
output.writeByte(skinParts);
int mainHand = PacketUtil.readVarInt(input);
System.out.println("Main hand: " + mainHand);
PacketUtil.readVarInt(input);
return;
}
if (packet == PacketType.PLAY_ANIMATION_REQUEST) {
int hand = PacketUtil.readVarInt(input);
System.out.println("Animation request " + hand);
PacketUtil.readVarInt(input);
return;
}
if (packet == PacketType.PLAY_USE_ENTITY) {
@ -161,7 +156,7 @@ public class IncomingTransformer {
output.writeFloat(targetZ);
}
if (type == 0 || type == 2) {
int hand = PacketUtil.readVarInt(input); // lel
PacketUtil.readVarInt(input);
}
return;
}
@ -171,7 +166,6 @@ public class IncomingTransformer {
int face = PacketUtil.readVarInt(input);
output.writeByte(face);
int hand = PacketUtil.readVarInt(input);
System.out.println("hand: " + hand);
// write item in hand
output.writeShort(-1);
@ -189,8 +183,6 @@ public class IncomingTransformer {
// Simulate using item :)
output.writeLong(-1L);
output.writeByte(-1);
int hand = PacketUtil.readVarInt(input);
System.out.println("hand: " + hand);
// write item in hand
output.writeShort(-1);

Datei anzeigen

@ -48,7 +48,7 @@ public class OutgoingTransformer {
if (packet == null) {
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)
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());
if (packet.getPacketID() != -1) {
packetID = packet.getNewPacketID();
@ -58,7 +58,6 @@ public class OutgoingTransformer {
PacketUtil.writeVarInt(packetID, output);
if (packet == PacketType.PLAY_NAMED_SOUND_EFFECT) {
// TODO: Port this over
System.out.println("cancelling");
throw new CancelException();
}
if (packet == PacketType.PLAY_ATTACH_ENTITY) {
@ -113,11 +112,11 @@ public class OutgoingTransformer {
if (packet == PacketType.PLAY_ENTITY_RELATIVE_MOVE) {
int id = PacketUtil.readVarInt(input);
PacketUtil.writeVarInt(id, output);
int x = input.readByte();
short x = (short) (input.readByte());
output.writeShort(x);
int y = input.readByte();
short y = (short) (input.readByte());
output.writeShort(y);
int z = input.readByte();
short z = (short) (input.readByte());
output.writeShort(z);
boolean onGround = input.readBoolean();
@ -290,12 +289,7 @@ public class OutgoingTransformer {
output.writeByte(pitch);
byte yaw = input.readByte();
output.writeByte(yaw);
// We don't use currentItem short lel
// transform entity meta data ugh
// get data watcher
try {
System.out.println("Last Packet Type: " + info.getLastPacket().getClass().getName());
DataWatcher dw = Core.getPrivateField(info.getLastPacket(), "i", DataWatcher.class);
transformMetadata(dw, output);
} catch (NoSuchFieldException e) {
@ -333,7 +327,6 @@ public class OutgoingTransformer {
input.readBytes(data);
boolean sk = false;
if (info.getLastPacket() instanceof PacketPlayOutMapChunkBulk) {
try {
sk = Core.getPrivateField(info.getLastPacket(), "d", boolean.class);
} catch (NoSuchFieldException e) {
@ -450,14 +443,12 @@ public class OutgoingTransformer {
break;
case Position:
BlockPosition blockposition = (BlockPosition) obj.b();
packetdataserializer.writeInt(blockposition.getX());
packetdataserializer.writeInt(blockposition.getY());
packetdataserializer.writeInt(blockposition.getZ());
break;
case Vector3F:
Vector3f vector3f = (Vector3f) obj.b();
packetdataserializer.writeFloat(vector3f.getX());
packetdataserializer.writeFloat(vector3f.getY());
packetdataserializer.writeFloat(vector3f.getZ());