Turned ClientCommand into an enum

Turned DataReq into an enum
Fixed clean up of Swing table (reverse index)
When /opis is used, the client requests a full set of data to populate the tables.
This commit is contained in:
ProfMobius committed 2014-03-18 15:47:35 +01:00
1 parent 59d3092131
commit 87b8f3f787
14 files changed
+148 -85

No files matched your search

@@ -7,30 +7,31 @@ import java.io.DataOutputStream;
import java.io.IOException;
import mcp.mobius.opis.network.Packets;
import mcp.mobius.opis.network.enums.ClientCommand;
import net.minecraft.network.packet.Packet250CustomPayload;
public class Packet_ClientCommand {
public byte header;
public byte cmd;
public byte header;
public ClientCommand cmd;
public Packet_ClientCommand(Packet250CustomPayload packet) {
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
try{
this.header = inputStream.readByte();
this.cmd = inputStream.readByte();
this.cmd = ClientCommand.values()[inputStream.readInt()];
} catch (IOException e){}
}
public static Packet250CustomPayload create(byte cmd){
public static Packet250CustomPayload create(ClientCommand cmd){
Packet250CustomPayload packet = new Packet250CustomPayload();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1);
DataOutputStream outputStream = new DataOutputStream(bos);
try{
outputStream.writeByte(Packets.CLIENT_CMD);
outputStream.writeByte(cmd);
outputStream.writeInt(cmd.ordinal());
}catch(IOException e){}
packet.channel = "Opis";