Java Code Examples for net.minecraft.item.Item.getItemStackLimit()

The following are Jave code examples for showing how to use getItemStackLimit() of the net.minecraft.item.Item class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Wurst-MC-1.12   File: GiveCmd.java   Source Code and License Vote up 5 votes
private int parseAmount(Item item, String input) throws CmdException
{
	if(!MiscUtils.isInteger(input))
		throw new CmdSyntaxError("Amount must be a number.");
	int amount = Integer.valueOf(input);
	if(amount < 1)
		throw new CmdError("Amount must be 1 or more.");
	if(amount > item.getItemStackLimit())
		throw new CmdError("Amount is larger than the maximum stack size.");
	return amount;
}
 
Example 2
Project: Zombe-Modpack   File: ZWrapper.java   Source Code and License Vote up 4 votes
public static int getItemMax(Item item) {
    return item == null ? 0 : item.getItemStackLimit();
}