#bug 1.21.80 in container

1 messages · Page 1 of 1 (latest)

next sentinel
#

[Scripting][error]-InvalidContainerSlotError: The container slot is either empty or is no longer loaded. at <anonymous> (projectileHitEntity.js:129)

    const equippable = player?.getComponent("equippable");
    const slotHead = equippable?.getEquipmentSlot(EquipmentSlot.Head);

    if(slotHead?.typeId === 'blc:armor'){
      return
   }

when I don't have the item in my head the log gives an error

quartz cloud
#

This part of the API is not my favorite design.

#

IIRC you need to check if the slot has an item first before trying to read its contents.

#

Does using slotHead.hasItem() throw an error too? @next sentinel