EntityItemFrameDirectionFix.java

net.minecraft.util.datafix.fixes.EntityItemFrameDirectionFix

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public EntityItemFrameDirectionFix(Schema outputSchema, boolean changesType) @ L9

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

参数:

  • outputSchema: Schema
  • changesType: boolean

说明:

TODO

方法

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

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

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

参数:

  • input: Dynamic<?>

说明:

TODO

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

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

参数:

  • entity: Typed<?>

说明:

TODO

private static byte direction2dTo3d(byte dir) @ L22

  • 方法名:direction2dTo3d
  • 源码定位:L22
  • 返回类型:byte
  • 修饰符:private static

参数:

  • dir: byte

说明:

TODO

代码

public class EntityItemFrameDirectionFix extends NamedEntityFix {
    public EntityItemFrameDirectionFix(Schema outputSchema, boolean changesType) {
        super(outputSchema, changesType, "EntityItemFrameDirectionFix", References.ENTITY, "minecraft:item_frame");
    }
 
    public Dynamic<?> fixTag(Dynamic<?> input) {
        return input.set("Facing", input.createByte(direction2dTo3d(input.get("Facing").asByte((byte)0))));
    }
 
    @Override
    protected Typed<?> fix(Typed<?> entity) {
        return entity.update(DSL.remainderFinder(), this::fixTag);
    }
 
    private static byte direction2dTo3d(byte dir) {
        switch (dir) {
            case 0:
                return 3;
            case 1:
                return 4;
            case 2:
            default:
                return 2;
            case 3:
                return 5;
        }
    }
}

引用的其他类