38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.datafixers.DSL
|
|
* com.mojang.datafixers.DSL$TypeReference
|
|
* com.mojang.datafixers.DataFix
|
|
* com.mojang.datafixers.TypeRewriteRule
|
|
* com.mojang.datafixers.Typed
|
|
* 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.Typed;
|
|
import com.mojang.datafixers.schemas.Schema;
|
|
|
|
public class EntityFallDistanceFloatToDoubleFix
|
|
extends DataFix {
|
|
private final DSL.TypeReference type;
|
|
|
|
public EntityFallDistanceFloatToDoubleFix(Schema outputSchema, DSL.TypeReference type) {
|
|
super(outputSchema, false);
|
|
this.type = type;
|
|
}
|
|
|
|
protected TypeRewriteRule makeRule() {
|
|
return this.fixTypeEverywhereTyped("EntityFallDistanceFloatToDoubleFixFor" + this.type.typeName(), this.getOutputSchema().getType(this.type), EntityFallDistanceFloatToDoubleFix::fixEntity);
|
|
}
|
|
|
|
private static Typed<?> fixEntity(Typed<?> entity) {
|
|
return entity.update(DSL.remainderFinder(), remainder -> remainder.renameAndFixField("FallDistance", "fall_distance", fallDistance -> fallDistance.createDouble((double)fallDistance.asFloat(0.0f))));
|
|
}
|
|
}
|
|
|