3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

Merge pull request #83 from StamBoom/master

Fix unmount
Dieser Commit ist enthalten in:
Myles 2016-03-03 12:56:54 +00:00
Commit e11c8320f0

Datei anzeigen

@ -34,6 +34,7 @@ public class OutgoingTransformer {
private boolean cancel = false; private boolean cancel = false;
private Map<Integer, UUID> uuidMap = new HashMap<Integer, UUID>(); private Map<Integer, UUID> uuidMap = new HashMap<Integer, UUID>();
private Map<Integer, EntityType> clientEntityTypes = new HashMap<Integer, EntityType>(); private Map<Integer, EntityType> clientEntityTypes = new HashMap<Integer, EntityType>();
private Map<Integer, Integer> vehicleMap = new HashMap<>();
public OutgoingTransformer(ConnectionInfo info) { public OutgoingTransformer(ConnectionInfo info) {
this.info = info; this.info = info;
@ -82,8 +83,17 @@ public class OutgoingTransformer {
if (!lead) { if (!lead) {
output.clear(); output.clear();
writeVarInt(PacketType.PLAY_SET_PASSENGERS.getNewPacketID(), output); writeVarInt(PacketType.PLAY_SET_PASSENGERS.getNewPacketID(), output);
if (vehicle == -1) {
if (!vehicleMap.containsKey(passenger))
throw new CancelException();
vehicle = vehicleMap.remove(passenger);
writeVarInt(vehicle,output);
writeVarIntArray(Collections.<Integer>emptyList(), output);
} else{
writeVarInt(vehicle, output); writeVarInt(vehicle, output);
writeVarIntArray(Collections.singletonList(passenger), output); writeVarIntArray(Collections.singletonList(passenger), output);
vehicleMap.put(passenger,vehicle);
}
return; return;
} }
output.writeInt(passenger); output.writeInt(passenger);