Validate supplied stack size

This commit is contained in:
Christian 2013-03-23 15:10:13 -04:00
parent 4550b5795a
commit 49ebcae9a1

View file

@ -409,6 +409,8 @@ public class GameRegistry
* Lookup an itemstack based on mod and name. It will create "default" itemstacks from blocks and items if no * Lookup an itemstack based on mod and name. It will create "default" itemstacks from blocks and items if no
* explicit itemstack is found. * explicit itemstack is found.
* *
* If it is built from a block, the metadata is by default the "wildcard" value.
*
* @param modId The modid of the stack owner * @param modId The modid of the stack owner
* @param name The name of the stack * @param name The name of the stack
* @param stackSize The size of the stack returned * @param stackSize The size of the stack returned
@ -417,7 +419,7 @@ public class GameRegistry
public static ItemStack findItemStack(String modId, String name, int stackSize) public static ItemStack findItemStack(String modId, String name, int stackSize)
{ {
ItemStack is = GameData.findItemStack(modId, name).func_77946_l(); ItemStack is = GameData.findItemStack(modId, name).func_77946_l();
is.field_77994_a = stackSize; is.field_77994_a = Math.min(stackSize, is.func_77976_d());
return is; return is;
} }
} }