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 {
private int entityIds[];
private int entityId;
private int passengerIds[];
@SuppressWarnings("unused")
private ServerEntitySetPassengersPacket() {
}
public ServerEntitySetPassengersPacket(int... entityIds) {
this.entityIds = entityIds;
public ServerEntitySetPassengersPacket(int entityId, int... passengerIds) {
this.entityId = entityId;
this.passengerIds = passengerIds;
}
public int[] getEntityIds() {
return this.entityIds;
public int getEntityId() {
return this.entityId;
}
public int[] getPassengerIds() {
return this.passengerIds;
}
@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();
this.entityId = in.readVarInt();
this.passengerIds = new int[in.readVarInt()];
for(int index = 0; index < this.passengerIds.length; index++) {
this.passengerIds[index] = in.readVarInt();
}
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityIds.length);
for(int entityId : this.entityIds) {
out.writeVarInt(this.entityId);
out.writeVarInt(this.passengerIds.length);
for(int entityId : this.passengerIds) {
out.writeVarInt(entityId);
}
}