Skip to content

Commit 1ba1438

Browse files
Implement ServerSetTextColorPacket class
1 parent c6c423c commit 1ba1438

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.github.steveice10.mc.classic.protocol.packet.server;
2+
3+
import com.github.steveice10.mc.classic.protocol.packet.ClassicPacketUtil;
4+
import com.github.steveice10.packetlib.io.NetInput;
5+
import com.github.steveice10.packetlib.io.NetOutput;
6+
import com.github.steveice10.packetlib.packet.Packet;
7+
8+
import java.io.IOException;
9+
10+
public class ServerSetTextColorPacket implements Packet {
11+
private int red;
12+
private int green;
13+
private int blue;
14+
private int alpha;
15+
private char code;
16+
17+
@SuppressWarnings("unused")
18+
private ServerSetTextColorPacket(){}
19+
20+
public ServerSetTextColorPacket(int red, int green, int blue, int alpha, char code){
21+
this.red = red;
22+
this.green = green;
23+
this.blue = blue;
24+
this.alpha = alpha;
25+
this.code = code;
26+
}
27+
public int getRed(){
28+
return this.red;
29+
}
30+
public int getGreen(){
31+
return this.green;
32+
}
33+
public int getBlue(){
34+
return this.blue;
35+
}
36+
public int getAlpha(){
37+
return this.alpha;
38+
}
39+
public char getCode(){
40+
return this.code;
41+
}
42+
43+
@Override
44+
public void read(NetInput in) throws IOException {
45+
this.red = (int) in.readUnsignedByte();
46+
this.green = (int) in.readUnsignedByte();
47+
this.blue = (int) in.readUnsignedByte();
48+
this.alpha = (int) in.readUnsignedByte();
49+
this.code = (char) in.readUnsignedByte();
50+
}
51+
@Override
52+
public void write(NetOutput out) throws IOException {
53+
out.writeByte((byte) this.red);
54+
out.writeByte((byte) this.green);
55+
out.writeByte((byte) this.blue);
56+
out.writeByte((byte) this.alpha);
57+
out.writeByte((byte) this.code);
58+
}
59+
}

0 commit comments

Comments
 (0)