BlendingDataRemoveFromNetherEndFix.java

net.minecraft.util.datafix.fixes.BlendingDataRemoveFromNetherEndFix

信息

  • 全限定名:net.minecraft.util.datafix.fixes.BlendingDataRemoveFromNetherEndFix
  • 类型:public class
  • 包:net.minecraft.util.datafix.fixes
  • 源码路径:src/main/java/net/minecraft/util/datafix/fixes/BlendingDataRemoveFromNetherEndFix.java
  • 起始行号:L11
  • 继承:DataFix
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public BlendingDataRemoveFromNetherEndFix(Schema outputSchema) @ L12

  • 构造器名:BlendingDataRemoveFromNetherEndFix
  • 源码定位:L12
  • 修饰符:public

参数:

  • outputSchema: Schema

说明:

TODO

方法

下面的方法块按源码顺序生成。

protected TypeRewriteRule makeRule() @ L16

  • 方法名:makeRule
  • 源码定位:L16
  • 返回类型:TypeRewriteRule
  • 修饰符:protected

参数:

说明:

TODO

private static Dynamic<?> updateChunkTag(Dynamic<?> chunkTag, OptionalDynamic<?> contextTag) @ L26

  • 方法名:updateChunkTag
  • 源码定位:L26
  • 返回类型:Dynamic<?>
  • 修饰符:private static

参数:

  • chunkTag: Dynamic<?>
  • contextTag: OptionalDynamic<?>

说明:

TODO

代码

public class BlendingDataRemoveFromNetherEndFix extends DataFix {
    public BlendingDataRemoveFromNetherEndFix(Schema outputSchema) {
        super(outputSchema, false);
    }
 
    @Override
    protected TypeRewriteRule makeRule() {
        Type<?> chunkType = this.getOutputSchema().getType(References.CHUNK);
        return this.fixTypeEverywhereTyped(
            "BlendingDataRemoveFromNetherEndFix",
            chunkType,
            chunk -> chunk.update(DSL.remainderFinder(), chunkTag -> updateChunkTag(chunkTag, chunkTag.get("__context")))
        );
    }
 
    private static Dynamic<?> updateChunkTag(Dynamic<?> chunkTag, OptionalDynamic<?> contextTag) {
        boolean isOverworld = "minecraft:overworld".equals(contextTag.get("dimension").asString().result().orElse(""));
        return isOverworld ? chunkTag : chunkTag.remove("blending_data");
    }
}

引用的其他类