package org.spacehq.mc.protocol.packet.ingame.server.entity;

import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

import java.io.IOException;

public class ServerEntitySetPassengersPacket implements Packet {

    private int entityIds[];

    @SuppressWarnings("unused")
    private ServerEntitySetPassengersPacket() {
    }

    public ServerEntitySetPassengersPacket(int... entityIds) {
        this.entityIds = entityIds;
    }

    public int[] getEntityIds() {
        return this.entityIds;
    }

    @Override
    public void read(NetInput in) throws IOException {
        this.entityIds = new int[in.readVarInt()];
        for(int index = 0; index < this.entityIds.length; index++) {
            this.entityIds[index] = in.readVarInt();
        }
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeVarInt(this.entityIds.length);
        for(int entityId : this.entityIds) {
            out.writeVarInt(entityId);
        }
    }

    @Override
    public boolean isPriority() {
        return false;
    }

}

@@ -304,16 +304,45 @@
 entityId
+;%0A    private int passengerId
 s%5B%5D;%0A%0A  
@@ -476,11 +476,8 @@
 (int
-...
  ent
@@ -473,32 +473,52 @@
 ket(int entityId
+, int... passengerId
 s) %7B%0A        thi
@@ -527,17 +527,16 @@
 entityId
-s
  = entit
@@ -530,32 +530,73 @@
 ityId = entityId
+;%0A        this.passengerIds = passengerId
 s;%0A    %7D%0A%0A    pu
@@ -603,18 +603,16 @@
 blic int
-%5B%5D
  getEnti
@@ -615,17 +615,16 @@
 EntityId
-s
 () %7B%0A   
@@ -648,16 +648,93 @@
 entityId
+;%0A    %7D%0A%0A    public int%5B%5D getPassengerIds() %7B%0A        return this.passengerId
 s;%0A    %7D
@@ -825,16 +825,60 @@
 entityId
+ = in.readVarInt();%0A        this.passengerId
 s = new 
@@ -935,30 +935,33 @@
 ndex %3C this.
-entity
+passenger
 Ids.length; 
@@ -988,22 +988,25 @@
    this.
-entity
+passenger
 Ids%5Binde
@@ -1153,16 +1153,59 @@
 entityId
+);%0A        out.writeVarInt(this.passengerId
 s.length
@@ -1239,22 +1239,25 @@
  : this.
-entity
+passenger
 Ids) %7B%0A 

Fix ServerEntitySetPassengersPacket.