package common.packet;

import java.io.IOException;

import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;

public class SPacketBiomes implements Packet<IClientPlayer> {
	private int chunkX;
	private int chunkZ;
	private byte[] biomes;

	public SPacketBiomes() {
	}

	public SPacketBiomes(int chunkX, int chunkZ, byte[] biomes) {
		this.chunkX = chunkX;
		this.chunkZ = chunkZ;
		this.biomes = biomes;
	}

	public void readPacketData(PacketBuffer buf) throws IOException {
		this.chunkX = buf.readInt();
		this.chunkZ = buf.readInt();
		buf.readBytes(this.biomes = new byte[256]);
	}

	public void writePacketData(PacketBuffer buf) throws IOException {
		buf.writeInt(this.chunkX);
		buf.writeInt(this.chunkZ);
		buf.writeBytes(this.biomes);
	}

	public void processPacket(IClientPlayer handler) {
		handler.handleBiomes(this);
	}

	public int getChunkX() {
		return this.chunkX;
	}

	public int getChunkZ() {
		return this.chunkZ;
	}

	public byte[] getBiomes() {
		return this.biomes;
	}
}
