mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-21 04:32:28 +00:00
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).
43 lines
1.1 KiB
Java
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;
|
|
}
|
|
|
|
}
|