minecraft_25w45a_unobfuscated/net/minecraft/util/datafix/fixes/OptionsFancyGraphicsToGraphicsModeFix.java
2025-11-24 22:52:51 +03:00

38 lines
1.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.DSL
* com.mojang.datafixers.DataFix
* com.mojang.datafixers.TypeRewriteRule
* com.mojang.datafixers.schemas.Schema
* com.mojang.serialization.Dynamic
*/
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.serialization.Dynamic;
import net.minecraft.util.datafix.fixes.References;
public class OptionsFancyGraphicsToGraphicsModeFix
extends DataFix {
public OptionsFancyGraphicsToGraphicsModeFix(Schema outputSchema) {
super(outputSchema, true);
}
public TypeRewriteRule makeRule() {
return this.fixTypeEverywhereTyped("fancyGraphics to graphicsMode", this.getInputSchema().getType(References.OPTIONS), input -> input.update(DSL.remainderFinder(), tag -> tag.renameAndFixField("fancyGraphics", "graphicsMode", OptionsFancyGraphicsToGraphicsModeFix::fixGraphicsMode)));
}
private static <T> Dynamic<T> fixGraphicsMode(Dynamic<T> field) {
if ("true".equals(field.asString("true"))) {
return field.createString("1");
}
return field.createString("0");
}
}