ItemDurabilityComponent#maxDurability failed to get property
When creating an 'ItemStack' and getting 'maxDurability' in the same expression, it throws an error. But when assigning the 'ItemStack' to a variable then accessing 'maxDurability' in a different expression, it works.
const item = new ItemStack("diamond_sword"); const maxDurability = item.getComponent("durability")?.maxDurability ?? 0; // works fine
const maxDurability = new ItemStack("diamond_sword").getComponent("durability")?.maxDurability ?? 0; // Error: failed to get property 'maxDurability'
2024-04-14, 11:57 PM
2024-08-29, 05:43 PM
2024-08-29, 05:43 PM
1
2
-