Handle new client intent

This commit is contained in:
Nassim Jahnke 2024-01-18 21:22:44 +01:00
parent 27af372f79
commit 52b9db5029
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 7 additions and 4 deletions

View File

@ -35,6 +35,10 @@ import java.util.List;
public class BaseProtocol extends AbstractProtocol {
private static final int STATUS_INTENT = 1;
private static final int LOGIN_INTENT = 2;
private static final int TRANSFER_INTENT = 3;
@Override
protected void registerPackets() {
// Handshake Packet
@ -89,10 +93,9 @@ public class BaseProtocol extends AbstractProtocol {
Via.getPlatform().getLogger().info("Protocol pipeline: " + pipeline.pipes());
}
// Change state
if (state == 1) {
if (state == STATUS_INTENT) {
info.setState(State.STATUS);
} else if (state == 2) {
} else if (state == LOGIN_INTENT || state == TRANSFER_INTENT) {
info.setState(State.LOGIN);
}
});

View File

@ -50,7 +50,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
wrapper.passthrough(Type.POSITION1_14); // Position
wrapper.passthrough(Type.VAR_INT); // Block entity type
// No longern nullable
// No longer nullable
final CompoundTag tag = wrapper.read(Type.COMPOUND_TAG);
wrapper.write(Type.COMPOUND_TAG, tag != null ? tag : new CompoundTag());
});