Spaces:
Build error
Build error
File size: 1,458 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.OpticFinder;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.serialization.Dynamic;
import java.util.Objects;
import java.util.Optional;
import net.minecraft.util.datafix.schemas.NamespacedSchema;
public class BlockEntityCustomNameToComponentFix extends DataFix {
public BlockEntityCustomNameToComponentFix(Schema p_14817_, boolean p_14818_) {
super(p_14817_, p_14818_);
}
@Override
public TypeRewriteRule makeRule() {
OpticFinder<String> opticfinder = DSL.fieldFinder("id", NamespacedSchema.namespacedString());
return this.fixTypeEverywhereTyped(
"BlockEntityCustomNameToComponentFix",
this.getInputSchema().getType(References.BLOCK_ENTITY),
p_14821_ -> p_14821_.update(
DSL.remainderFinder(),
p_145133_ -> {
Optional<String> optional = p_14821_.getOptional(opticfinder);
return optional.isPresent() && Objects.equals(optional.get(), "minecraft:command_block")
? p_145133_
: EntityCustomNameToComponentFix.fixTagCustomName(p_145133_);
}
)
);
}
} |