Skip to content

[Bug] 不存在的物品可以创建物品成功但获取it.maxDamage会崩服 #393

Description

@Hurry1027

Describe the bug

用不存在的物品类型名新建物品居然可以返回item类型而不是null,而后面获取it.maxDamage属性会直接崩服
意外发现的,不是什么大问题,用正确的物品类型名就好。
但这样直接崩服会让服主不好排查问题,捕获此异常可以提高LSE的稳定性

To Reproduce

const it = mc.newItem("minecraft:sdfsdf", 1);
log(it);
log(it.maxDamage);

Expected behavior

不存在的物品类型名新建物品时正确返回null或在lse层抛出错误

Screenshots

No response

Platform

No response

BDS Version

20.51

LeviLamina Version

26.51.5

LegacyScriptEngine Version

0.22.2

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions