Itemstack size procedure blocks

Upvotes: 8
Issue description

The procedure blocks would be "Get stack size", "Set stack size to <amount>", "Shrink stack size by <amount>" and "Grow stack size by <amount>".

The required code is: 

// Get stack size
int amount = ItemStack.getCount();

// Set stack size
ItemStack.setCount(int amount);

// Shrink stack
ItemStack.shrink(int quantity);

// Grow stack
ItemStack.grow(int quantity);

In particular, the shrink block would be extremely useful for consumable items. Although there's a "Consume item in inventory" block, it isn't guaranteed to take the item from the active stack.

Issue comments

This is so useful for removing items in the Hotbar when a certain thing happens. If anyone has a workaround please let me know 

Yes, but the plugin is not preinstalled. So we should just stop working on MCreator and leave all on the plugins? XD

I know, I was joking :P What I wanted to say is that is totally possible that some plugins will eventually overlap with some of the core features :)

Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.