42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.datafixers.DSL
|
|
* com.mojang.datafixers.DataFix
|
|
* com.mojang.datafixers.DataFixUtils
|
|
* 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.DataFixUtils;
|
|
import com.mojang.datafixers.TypeRewriteRule;
|
|
import com.mojang.datafixers.schemas.Schema;
|
|
import com.mojang.serialization.Dynamic;
|
|
import java.util.Optional;
|
|
import net.minecraft.util.datafix.fixes.References;
|
|
|
|
public class OptionsAmbientOcclusionFix
|
|
extends DataFix {
|
|
public OptionsAmbientOcclusionFix(Schema outputSchema) {
|
|
super(outputSchema, false);
|
|
}
|
|
|
|
public TypeRewriteRule makeRule() {
|
|
return this.fixTypeEverywhereTyped("OptionsAmbientOcclusionFix", this.getInputSchema().getType(References.OPTIONS), input -> input.update(DSL.remainderFinder(), tag -> (Dynamic)DataFixUtils.orElse((Optional)tag.get("ao").asString().map(value -> tag.set("ao", tag.createString(OptionsAmbientOcclusionFix.updateValue(value)))).result(), (Object)tag)));
|
|
}
|
|
|
|
private static String updateValue(String value) {
|
|
return switch (value) {
|
|
case "0" -> "false";
|
|
case "1", "2" -> "true";
|
|
default -> value;
|
|
};
|
|
}
|
|
}
|
|
|