minecraft_25w45a_unobfuscated/net/minecraft/util/datafix/fixes/OminousBannerBlockEntityRenameFix.java
2025-11-24 22:52:51 +03:00

35 lines
1.4 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.DSL
* com.mojang.datafixers.OpticFinder
* com.mojang.datafixers.Typed
* com.mojang.datafixers.schemas.Schema
* com.mojang.datafixers.types.Type
*/
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.OpticFinder;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.types.Type;
import net.minecraft.util.datafix.fixes.NamedEntityFix;
import net.minecraft.util.datafix.fixes.References;
public class OminousBannerBlockEntityRenameFix
extends NamedEntityFix {
public OminousBannerBlockEntityRenameFix(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType, "OminousBannerBlockEntityRenameFix", References.BLOCK_ENTITY, "minecraft:banner");
}
@Override
protected Typed<?> fix(Typed<?> entity) {
OpticFinder customNameF = entity.getType().findField("CustomName");
OpticFinder textComponentF = DSL.typeFinder((Type)this.getInputSchema().getType(References.TEXT_COMPONENT));
return entity.updateTyped(customNameF, customName -> customName.update(textComponentF, pair -> pair.mapSecond(name -> name.replace("\"translate\":\"block.minecraft.illager_banner\"", "\"translate\":\"block.minecraft.ominous_banner\""))));
}
}