3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Fixed riding on entities.

Dieser Commit ist enthalten in:
Mats 2016-03-01 15:28:17 +01:00
Ursprung 7831dc0082
Commit 6f25090c01
3 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -184,6 +184,13 @@ public class PacketUtil {
} }
} }
public static void writeVarIntArray(List<Integer> integers, ByteBuf output) {
writeVarInt(integers.size(),output);
for (Integer i : integers){
writeVarInt(i,output);
}
}
public static int readVarShort(ByteBuf buf) { public static int readVarShort(ByteBuf buf) {
int low = buf.readUnsignedShort(); int low = buf.readUnsignedShort();
int high = 0; int high = 0;

Datei anzeigen

@ -36,7 +36,7 @@ public class IncomingTransformer {
// 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 || packet == PacketType.PLAY_VEHICLE_MOVE_REQUEST) { //TODO handle client-sided horse riding
throw new CancelException(); throw new CancelException();
} }
PacketUtil.writeVarInt(packetID, output); PacketUtil.writeVarInt(packetID, output);

Datei anzeigen

@ -25,8 +25,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import static us.myles.ViaVersion.PacketUtil.readString; import static us.myles.ViaVersion.PacketUtil.*;
import static us.myles.ViaVersion.PacketUtil.writeString;
public class OutgoingTransformer { public class OutgoingTransformer {
private static Gson gson = new Gson(); private static Gson gson = new Gson();
@ -75,10 +74,18 @@ public class OutgoingTransformer {
output.writeBytes(input); output.writeBytes(input);
} }
if (packet == PacketType.PLAY_ATTACH_ENTITY) { if (packet == PacketType.PLAY_ATTACH_ENTITY) {
int id = input.readInt(); int passenger = input.readInt();
output.writeInt(id); int vehicle = input.readInt();
int target = input.readInt(); boolean lead = input.readBoolean();
output.writeInt(target); if (!lead){
output.clear();
writeVarInt(PacketType.PLAY_SET_PASSENGERS.getNewPacketID(),output);
writeVarInt(vehicle,output);
writeVarIntArray(Collections.singletonList(passenger),output);
return;
}
output.writeInt(passenger);
output.writeInt(vehicle);
return; return;
} }
if (packet == PacketType.PLAY_DISCONNECT){ if (packet == PacketType.PLAY_DISCONNECT){