--- a/net/minecraft/network/codec/StreamCodec.java
+++ b/net/minecraft/network/codec/StreamCodec.java
@@ -296,7 +296,7 @@
     }
 
     default <S extends B> StreamCodec<S, V> cast() {
-        return this;
+        return (StreamCodec<S, V>)this;
     }
 
     @FunctionalInterface
