Skip to content

Commit 57ecdc4

Browse files
committed
Use proper "codec → stream codec" method, do away with unwise cast
Could help address #196
1 parent 51f3b3c commit 57ecdc4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/gripe/_90/megacells/misc/CompressionChain.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,12 @@ public int hashCode() {
189189
}
190190

191191
record Variant(AEItemKey item, int factor) {
192-
private static final StreamCodec<RegistryFriendlyByteBuf, AEItemKey> ITEM_KEY_CODEC =
193-
AEItemKey.STREAM_CODEC.map(k -> (AEItemKey) k, k -> k);
194192
private static final StreamCodec<RegistryFriendlyByteBuf, Variant> STREAM_CODEC = StreamCodec.composite(
195-
ITEM_KEY_CODEC, Variant::item, ByteBufCodecs.VAR_INT, Variant::factor, Variant::new);
193+
ByteBufCodecs.fromCodec(AEItemKey.CODEC),
194+
Variant::item,
195+
ByteBufCodecs.VAR_INT,
196+
Variant::factor,
197+
Variant::new);
196198

197199
private BigInteger big() {
198200
return BigInteger.valueOf(factor);

0 commit comments

Comments
 (0)