2025-11-24 22:52:51 +03:00

41 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
*/
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 net.minecraft.util.datafix.fixes.References;
public class OptionsMenuBlurrinessFix
extends DataFix {
public OptionsMenuBlurrinessFix(Schema outputSchema) {
super(outputSchema, false);
}
public TypeRewriteRule makeRule() {
return this.fixTypeEverywhereTyped("OptionsMenuBlurrinessFix", this.getInputSchema().getType(References.OPTIONS), input -> input.update(DSL.remainderFinder(), tag -> tag.update("menuBackgroundBlurriness", value -> {
int intValue = this.convertToIntRange(value.asString("0.5"));
return value.createString(String.valueOf(intValue));
})));
}
private int convertToIntRange(String floatBlurriness) {
try {
return Math.round(Float.parseFloat(floatBlurriness) * 10.0f);
}
catch (NumberFormatException e) {
return 5;
}
}
}