Handle new client intent
This commit is contained in:
parent
27af372f79
commit
52b9db5029
|
@ -35,6 +35,10 @@ import java.util.List;
|
||||||
|
|
||||||
public class BaseProtocol extends AbstractProtocol {
|
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
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Handshake Packet
|
// Handshake Packet
|
||||||
|
@ -89,10 +93,9 @@ public class BaseProtocol extends AbstractProtocol {
|
||||||
Via.getPlatform().getLogger().info("Protocol pipeline: " + pipeline.pipes());
|
Via.getPlatform().getLogger().info("Protocol pipeline: " + pipeline.pipes());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change state
|
if (state == STATUS_INTENT) {
|
||||||
if (state == 1) {
|
|
||||||
info.setState(State.STATUS);
|
info.setState(State.STATUS);
|
||||||
} else if (state == 2) {
|
} else if (state == LOGIN_INTENT || state == TRANSFER_INTENT) {
|
||||||
info.setState(State.LOGIN);
|
info.setState(State.LOGIN);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||||
wrapper.passthrough(Type.POSITION1_14); // Position
|
wrapper.passthrough(Type.POSITION1_14); // Position
|
||||||
wrapper.passthrough(Type.VAR_INT); // Block entity type
|
wrapper.passthrough(Type.VAR_INT); // Block entity type
|
||||||
|
|
||||||
// No longern nullable
|
// No longer nullable
|
||||||
final CompoundTag tag = wrapper.read(Type.COMPOUND_TAG);
|
final CompoundTag tag = wrapper.read(Type.COMPOUND_TAG);
|
||||||
wrapper.write(Type.COMPOUND_TAG, tag != null ? tag : new CompoundTag());
|
wrapper.write(Type.COMPOUND_TAG, tag != null ? tag : new CompoundTag());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue