Touhou Little Maid

Touhou Little Maid

3M Downloads

[Bug] 注册女仆TaskData时无法传入基础Codec,而是需要包装

QiChenSn opened this issue · 0 comments

commented

Minecraft Version

  • 1.12.2 (End of support)
  • 1.16.5 (End of support)
  • 1.18.2 (End of support)
  • 1.19.2 (End of support)
  • 1.20/1.20.1
  • 1.21/1.21.1

What happened?

例如以下使用以下代码注册女仆TaskData

@LittleMaidExtension
public class LostMaidData implements ILittleMaid {
    public static TaskDataKey<Boolean> IS_LOST_MAID;
    @Override
    public void registerTaskData(TaskDataRegister register) {
        IS_LOST_MAID = register.register(
                ResourceLocation.fromNamespaceAndPath(MODID, "is_lost_maid"),
                Codec.BOOL  
        );
    }
}

将无法正常读写IS_LOST_MAID中的数据

需要改为

@Override
    public void registerTaskData(TaskDataRegister register) {
        IS_LOST_MAID = register.register(
                ResourceLocation.fromNamespaceAndPath(MODID, "is_lost_maid"),
                Codec.BOOL.fieldOf("value").codec()  // 包装
        );
    }

Relevant log output

Contact Details

No response