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:
LabyStudio
2022-06-19 14:25:40 +02:00
parent 2e42d482ed
commit 7266a89f5a
67 changed files with 11831 additions and 2761 deletions
@@ -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
];
}
}