Alright, I've got this, but I feel like i'm being really stupid.
public class ApeData implements BiConsumer<MSG, FriendlyByteBuf>, Function<FriendlyByteBuf, MSG> {
BlockPos blockPos = null;
public ApeData(BlockPos blockPos) {
this.blockPos = blockPos;
}
public FriendlyByteBuf getFriendlyByteBuf() {
ByteBuf bb = null;
FriendlyByteBuf fbb = new FriendlyByteBuf(bb);
fbb.writeBlockPos(this.blockPos);
return fbb;
}
public void setBlockPos(BlockPos blockPos) {
this.blockPos = blockPos;
}
public BlockPos getBlockPos() {
return this.blockPos;
}
@Override
public void accept(MSG t, FriendlyByteBuf u) {
// TODO Auto-generated method stub
}
@Override
public MSG apply(FriendlyByteBuf t) {
// TODO Auto-generated method stub
return null;
}
}
Then I do this to try to register it
ByteBuffer bb;
ApeData data = new ApeData(new BlockPos(0,0,0));
ApeDataNetwork dataNetwork = new ApeDataNetwork();
INSTANCE.registerMessage(0, new MSG(bb), data, dataNetwork); // ERROR
But on the line where I commented "ERROR"
I get this.
The method registerMessage(int, Class<MSG>, BiConsumer<MSG,FriendlyByteBuf>, Function<FriendlyByteBuf,MSG>, BiConsumer<MSG,Supplier<NetworkEvent.Context>>) in the type SimpleChannel is not applicable for the arguments (int, MSG, ApeData, ApeDataNetwork)
Ignore the first 2 parameters
I'm lacking a bit of java knowledge here.
I did as you said and made a new class that implements all that stuff.