ForcePoiRebuild.java

net.minecraft.util.datafix.fixes.ForcePoiRebuild

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public ForcePoiRebuild(Schema outputSchema, boolean changesType) @ L13

  • 构造器名:ForcePoiRebuild
  • 源码定位:L13
  • 修饰符:public

参数:

  • outputSchema: Schema
  • changesType: boolean

说明:

TODO

方法

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

protected TypeRewriteRule makeRule() @ L17

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

参数:

说明:

TODO

private static <T> Dynamic<T> cap(Dynamic<T> input) @ L27

  • 方法名:cap
  • 源码定位:L27
  • 返回类型: Dynamic
  • 修饰符:private static

参数:

  • input: Dynamic

说明:

TODO

代码

public class ForcePoiRebuild extends DataFix {
    public ForcePoiRebuild(Schema outputSchema, boolean changesType) {
        super(outputSchema, changesType);
    }
 
    @Override
    protected TypeRewriteRule makeRule() {
        Type<Pair<String, Dynamic<?>>> poiChunkType = DSL.named(References.POI_CHUNK.typeName(), DSL.remainderType());
        if (!Objects.equals(poiChunkType, this.getInputSchema().getType(References.POI_CHUNK))) {
            throw new IllegalStateException("Poi type is not what was expected.");
        } else {
            return this.fixTypeEverywhere("POI rebuild", poiChunkType, ops -> input -> input.mapSecond(ForcePoiRebuild::cap));
        }
    }
 
    private static <T> Dynamic<T> cap(Dynamic<T> input) {
        return input.update("Sections", sections -> sections.updateMapValues(entry -> entry.mapSecond(section -> section.remove("Valid"))));
    }
}

引用的其他类