Files
Opis/mcp/mobius/opis/network/Packet0x02RequestChunkStatus.java
T
ProfMobius e676b8dc23 Added tick & player handlers to the server to keep track of players and send updates when required.
Client can request a chunk status update (Packet0x02)
OverlayLoadedchunk is now a singleton and will send a request packet when activated.
Player status is saved in the server proxy.
ChunkData is a "static" class to gather chunk related data (loaded chunks for now).
2013-10-28 00:13:05 +01:00

43 lines
1.1 KiB
Java

package mcp.mobius.opis.network;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.network.packet.Packet250CustomPayload;
public class Packet0x02RequestChunkStatus {
public byte header;
public int dimension;
public Packet0x02RequestChunkStatus(Packet250CustomPayload packet) {
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
try{
this.header = inputStream.readByte();
this.dimension = inputStream.readInt();
} catch (IOException e){}
}
public static Packet250CustomPayload create(int dimension){
Packet250CustomPayload packet = new Packet250CustomPayload();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1);
DataOutputStream outputStream = new DataOutputStream(bos);
try{
outputStream.writeByte(0x02);
outputStream.writeInt(dimension);
}catch(IOException e){}
packet.channel = "Opis";
packet.data = bos.toByteArray();
packet.length = bos.size();
return packet;
}
}