mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 19:45:21 +01:00
Merge pull request #17 from StamBoom/master
Fixed riding on entities. (To some extent)
This commit is contained in:
commit
46ec24a686
@ -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) {
|
||||
int low = buf.readUnsignedShort();
|
||||
int high = 0;
|
||||
|
@ -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) {
|
||||
// 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();
|
||||
}
|
||||
PacketUtil.writeVarInt(packetID, output);
|
||||
|
@ -25,8 +25,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
import static us.myles.ViaVersion.PacketUtil.readString;
|
||||
import static us.myles.ViaVersion.PacketUtil.writeString;
|
||||
import static us.myles.ViaVersion.PacketUtil.*;
|
||||
|
||||
public class OutgoingTransformer {
|
||||
private static Gson gson = new Gson();
|
||||
@ -75,10 +74,18 @@ public class OutgoingTransformer {
|
||||
output.writeBytes(input);
|
||||
}
|
||||
if (packet == PacketType.PLAY_ATTACH_ENTITY) {
|
||||
int id = input.readInt();
|
||||
output.writeInt(id);
|
||||
int target = input.readInt();
|
||||
output.writeInt(target);
|
||||
int passenger = input.readInt();
|
||||
int vehicle = input.readInt();
|
||||
boolean lead = input.readBoolean();
|
||||
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;
|
||||
}
|
||||
if (packet == PacketType.PLAY_DISCONNECT){
|
||||
|
Loading…
Reference in New Issue
Block a user