drop custom items if giving and inventory is full
This commit is contained in:
@@ -19,8 +19,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) {
|
||||
|
||||
Reference in New Issue
Block a user