Varbits are just a bitmask over the config in the end, so if you get hold of the config, most- and least significant bit, you can get the varbit value via something like this
EQUIPPED_WEAPON_TYPE(843, 5, 0);
private final int configId;
private final int msb;
private final int lsb;
Varbits(int configId, int msb, int lsb) {
this.configId = configId;
this.msb = msb;
this.lsb = lsb;
}
public int getValue(Configs configs) {
int mask = (1 << ((msb - lsb) + 1)) - 1;
return (configs.get(configId) >> lsb) & mask;
}