RemoveGolemGossipFix.java

net.minecraft.util.datafix.fixes.RemoveGolemGossipFix

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public RemoveGolemGossipFix(Schema outputSchema, boolean changesType) @ L9

  • 构造器名:RemoveGolemGossipFix
  • 源码定位:L9
  • 修饰符:public

参数:

  • outputSchema: Schema
  • changesType: boolean

说明:

TODO

方法

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

protected Typed<?> fix(Typed<?> entity) @ L13

  • 方法名:fix
  • 源码定位:L13
  • 返回类型:Typed<?>
  • 修饰符:protected

参数:

  • entity: Typed<?>

说明:

TODO

private static Dynamic<?> fixValue(Dynamic<?> tag) @ L18

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

参数:

  • tag: Dynamic<?>

说明:

TODO

代码

public class RemoveGolemGossipFix extends NamedEntityFix {
    public RemoveGolemGossipFix(Schema outputSchema, boolean changesType) {
        super(outputSchema, changesType, "Remove Golem Gossip Fix", References.ENTITY, "minecraft:villager");
    }
 
    @Override
    protected Typed<?> fix(Typed<?> entity) {
        return entity.update(DSL.remainderFinder(), RemoveGolemGossipFix::fixValue);
    }
 
    private static Dynamic<?> fixValue(Dynamic<?> tag) {
        return tag.update("Gossips", gossips -> tag.createList(gossips.asStream().filter(attribute -> !attribute.get("Type").asString("").equals("golem"))));
    }
}

引用的其他类