implement packet compression, implement player controller, implement join server authentication, add cobblestone, implement chunk provider, implement block position, implement session, implement movement, chunk, chat and block update packets, version 1.1.5
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
export default class ProtocolState {
|
||||
static HANDSHAKE = -1;
|
||||
static PLAY = 0;
|
||||
static STATUS = 1;
|
||||
static LOGIN = 2;
|
||||
static HANDSHAKE = new ProtocolState(-1);
|
||||
static PLAY = new ProtocolState(0);
|
||||
static STATUS = new ProtocolState(1);
|
||||
static LOGIN = new ProtocolState(2);
|
||||
|
||||
static getName(state) {
|
||||
switch (state) {
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
getName() {
|
||||
switch (this) {
|
||||
case ProtocolState.HANDSHAKE:
|
||||
return "HANDSHAKE";
|
||||
case ProtocolState.LOGIN:
|
||||
@@ -18,4 +26,22 @@ export default class ProtocolState {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static fromId(id) {
|
||||
for (let state of this.values()) {
|
||||
if (state.getId() === id) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static values() {
|
||||
return [
|
||||
ProtocolState.HANDSHAKE,
|
||||
ProtocolState.LOGIN,
|
||||
ProtocolState.PLAY,
|
||||
ProtocolState.STATUS
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user