drop custom items if giving and inventory is full

This commit is contained in:
ForestOfLight
2025-06-07 22:59:11 -07:00
Unverified
parent aa7b0a7273
commit aa3b21477b
3 changed files with 12 additions and 6 deletions
@@ -21,8 +21,10 @@ function giveActionItem(playerId) {
const player = world.getEntity(playerId);
const container = player.getComponent(EntityComponentTypes.Inventory)?.container;
const itemStack = new ItemStack('construct:easy_place');
if (!container.contains(itemStack))
container.addItem(itemStack);
if (!container.contains(itemStack)) {
const remainingItemStack = container.addItem(itemStack);
player.dimension.spawnItem(remainingItemStack, player.location);
}
}
function removeActionItem(playerId) {