Spaces:
Build error
Build error
File size: 1,419 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 |
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.types.templates.TaggedChoice.TaggedChoiceType;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.DynamicOps;
import java.util.function.UnaryOperator;
public class BlockEntityRenameFix extends DataFix {
private final String name;
private final UnaryOperator<String> nameChangeLookup;
private BlockEntityRenameFix(Schema p_277450_, String p_278025_, UnaryOperator<String> p_277596_) {
super(p_277450_, true);
this.name = p_278025_;
this.nameChangeLookup = p_277596_;
}
@Override
public TypeRewriteRule makeRule() {
TaggedChoiceType<String> taggedchoicetype = (TaggedChoiceType<String>)this.getInputSchema().findChoiceType(References.BLOCK_ENTITY);
TaggedChoiceType<String> taggedchoicetype1 = (TaggedChoiceType<String>)this.getOutputSchema().findChoiceType(References.BLOCK_ENTITY);
return this.fixTypeEverywhere(this.name, taggedchoicetype, taggedchoicetype1, p_277946_ -> p_277512_ -> p_277512_.mapFirst(this.nameChangeLookup));
}
public static DataFix create(Schema p_278009_, String p_277879_, UnaryOperator<String> p_277753_) {
return new BlockEntityRenameFix(p_278009_, p_277879_, p_277753_);
}
} |