EntityShulkerRotationFix.java

net.minecraft.util.datafix.fixes.EntityShulkerRotationFix

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public EntityShulkerRotationFix(Schema outputSchema) @ L10

  • 构造器名:EntityShulkerRotationFix
  • 源码定位:L10
  • 修饰符:public

参数:

  • outputSchema: Schema

说明:

TODO

方法

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

public Dynamic<?> fixTag(Dynamic<?> input) @ L14

  • 方法名:fixTag
  • 源码定位:L14
  • 返回类型:Dynamic<?>
  • 修饰符:public

参数:

  • input: Dynamic<?>

说明:

TODO

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

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

参数:

  • entity: Typed<?>

说明:

TODO

代码

public class EntityShulkerRotationFix extends NamedEntityFix {
    public EntityShulkerRotationFix(Schema outputSchema) {
        super(outputSchema, false, "EntityShulkerRotationFix", References.ENTITY, "minecraft:shulker");
    }
 
    public Dynamic<?> fixTag(Dynamic<?> input) {
        List<Double> rotation = input.get("Rotation").asList(d -> d.asDouble(180.0));
        if (!rotation.isEmpty()) {
            rotation.set(0, rotation.get(0) - 180.0);
            return input.set("Rotation", input.createList(rotation.stream().map(input::createDouble)));
        } else {
            return input;
        }
    }
 
    @Override
    protected Typed<?> fix(Typed<?> entity) {
        return entity.update(DSL.remainderFinder(), this::fixTag);
    }
}

引用的其他类