Fabric API

Fabric API

112M Downloads

`ExtendedScreenHandlerType` requires `RegistryByteBuf` Packet Codecs

Kneelawk opened this issue ยท 4 comments

commented

The Issue

Currently, the ExtendedScreenHandlerType constructor takes a PacketCodec<RegistryByteBuf, D>. This forces all codecs being used to accept a RegistryByteBuf. ExtendedScreenHandlerType's constructor should probably take a PacketCodec<? super RegistryByteBuf, D> instead.

commented

I'll let @deirn investigate this

commented

That only a problem if you reuse PacketCodec from another code, which I doubt most people are.
I would imagine most screen handlers require a custom data record.

Even if you reuse the codec, can't you just call PacketCodec#cast to make the compiler happy?

commented

Yes, cast() works. It's just a mild annoyance. Sometimes you just want to send a BlockPos as your whole payload.

commented

I think this should be changed, it should be backwards compatible as well.