mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-29 05:26:23 +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) {
|
public static int readVarShort(ByteBuf buf) {
|
||||||
int low = buf.readUnsignedShort();
|
int low = buf.readUnsignedShort();
|
||||||
int high = 0;
|
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) {
|
// 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);
|
||||||
|
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user