Fix ServerEntitySetPassengersPacket.

This commit is contained in:
Steven Smith 2016-03-12 10:42:10 -08:00
parent e447052eca
commit 7dd6887fed

View file

@ -8,32 +8,40 @@ import java.io.IOException;
public class ServerEntitySetPassengersPacket implements Packet { public class ServerEntitySetPassengersPacket implements Packet {
private int entityIds[]; private int entityId;
private int passengerIds[];
@SuppressWarnings("unused") @SuppressWarnings("unused")
private ServerEntitySetPassengersPacket() { private ServerEntitySetPassengersPacket() {
} }
public ServerEntitySetPassengersPacket(int... entityIds) { public ServerEntitySetPassengersPacket(int entityId, int... passengerIds) {
this.entityIds = entityIds; this.entityId = entityId;
this.passengerIds = passengerIds;
} }
public int[] getEntityIds() { public int getEntityId() {
return this.entityIds; return this.entityId;
}
public int[] getPassengerIds() {
return this.passengerIds;
} }
@Override @Override
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.entityIds = new int[in.readVarInt()]; this.entityId = in.readVarInt();
for(int index = 0; index < this.entityIds.length; index++) { this.passengerIds = new int[in.readVarInt()];
this.entityIds[index] = in.readVarInt(); for(int index = 0; index < this.passengerIds.length; index++) {
this.passengerIds[index] = in.readVarInt();
} }
} }
@Override @Override
public void write(NetOutput out) throws IOException { public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityIds.length); out.writeVarInt(this.entityId);
for(int entityId : this.entityIds) { out.writeVarInt(this.passengerIds.length);
for(int entityId : this.passengerIds) {
out.writeVarInt(entityId); out.writeVarInt(entityId);
} }
} }