CarvingStepRemoveFix.java
net.minecraft.util.datafix.fixes.CarvingStepRemoveFix
信息
- 全限定名:net.minecraft.util.datafix.fixes.CarvingStepRemoveFix
- 类型:public class
- 包:net.minecraft.util.datafix.fixes
- 源码路径:src/main/java/net/minecraft/util/datafix/fixes/CarvingStepRemoveFix.java
- 起始行号:L11
- 继承:DataFix
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
public CarvingStepRemoveFix(Schema outputSchema) @ L12
- 构造器名:CarvingStepRemoveFix
- 源码定位:L12
- 修饰符:public
参数:
- outputSchema: Schema
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected TypeRewriteRule makeRule() @ L16
- 方法名:makeRule
- 源码定位:L16
- 返回类型:TypeRewriteRule
- 修饰符:protected
参数:
- 无
说明:
TODO
private static Typed<?> fixChunk(Typed<?> input) @ L21
- 方法名:fixChunk
- 源码定位:L21
- 返回类型:Typed<?>
- 修饰符:private static
参数:
- input: Typed<?>
说明:
TODO
代码
public class CarvingStepRemoveFix extends DataFix {
public CarvingStepRemoveFix(Schema outputSchema) {
super(outputSchema, false);
}
@Override
protected TypeRewriteRule makeRule() {
return this.fixTypeEverywhereTyped("CarvingStepRemoveFix", this.getInputSchema().getType(References.CHUNK), CarvingStepRemoveFix::fixChunk);
}
private static Typed<?> fixChunk(Typed<?> input) {
return input.update(DSL.remainderFinder(), chunkIn -> {
Dynamic<?> chunk = chunkIn;
Optional<? extends Dynamic<?>> carvingMasks = chunkIn.get("CarvingMasks").result();
if (carvingMasks.isPresent()) {
Optional<? extends Dynamic<?>> mask = carvingMasks.get().get("AIR").result();
if (mask.isPresent()) {
chunk = chunkIn.set("carving_mask", (Dynamic<?>)mask.get());
}
}
return chunk.remove("CarvingMasks");
});
}
}引用的其他类
- Schema
- 引用位置:
参数
- 引用位置: