--- a/net/minecraft/network/chat/ComponentSerialization.java
+++ b/net/minecraft/network/chat/ComponentSerialization.java
@@ -138,7 +138,7 @@
             for(MapDecoder<? extends T> mapdecoder : this.codecs) {
                 DataResult<? extends T> dataresult = mapdecoder.decode(p_304922_, p_304447_);
                 if (dataresult.result().isPresent()) {
-                    return dataresult;
+                    return (DataResult<T>)dataresult;
                 }
             }
 
@@ -147,7 +147,7 @@
 
         @Override
         public <S> RecordBuilder<S> encode(T p_304409_, DynamicOps<S> p_304945_, RecordBuilder<S> p_304823_) {
-            MapEncoder<T> mapencoder = this.encoderGetter.apply(p_304409_);
+            MapEncoder<T> mapencoder = (MapEncoder<T>)this.encoderGetter.apply(p_304409_);
             return mapencoder.encode(p_304409_, p_304945_, p_304823_);
         }
 
