Code/net/minecraft/util/datafix/fixes/TextComponentStrictJsonFix....

21 lines
880 B
Java
Raw Permalink Normal View History

2025-07-01 06:20:03 +00:00
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.types.Type;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.DynamicOps;
import net.minecraft.util.datafix.LegacyComponentDataFixUtils;
public class TextComponentStrictJsonFix extends DataFix {
public TextComponentStrictJsonFix(Schema p_393472_) {
super(p_393472_, false);
}
@Override
protected TypeRewriteRule makeRule() {
Type<Pair<String, String>> type = (Type<Pair<String, String>>)this.getInputSchema().getType(References.TEXT_COMPONENT);
return this.fixTypeEverywhere("TextComponentStrictJsonFix", type, p_397503_ -> p_393832_ -> p_393832_.mapSecond(LegacyComponentDataFixUtils::rewriteFromLenient));
}
}