#How can i remove 1x of the holding item
1 messages · Page 1 of 1 (latest)
const equip = <Entity>.getComponent('equippable');
const item = equip.getEquipment('Mainhand');
if(!item) return;
item.amount--;
equip.setEquipment('Mainhand', item);
player.getComponent(`equippable`).getEquipmentSlot(EquipmentSlot.Mainhand)
``` I know so far helps with there holding
Oh he already helped
Idk how to remove 1
Ty that helped me
The "amount" can only accept numbers from 1 to 255. When "amount" equals 1, it should enter another processing procedure, such as an immediate return or setting "Mainhand" to empty. I'm not sure what will happen when "amount" is set to 0 because I haven't tried it yet.
Oh true!
You can do
container.setItem(x, (item.amount === 1 ? undefined : (item.amount--, item)))
btw how did you made it "colorful" mines looks just white