From ede93d438f2b5fab92cd6a459247ca158354e430 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 23 Mar 2013 15:10:13 -0400 Subject: [PATCH] Validate supplied stack size --- common/cpw/mods/fml/common/registry/GameRegistry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/cpw/mods/fml/common/registry/GameRegistry.java b/common/cpw/mods/fml/common/registry/GameRegistry.java index 7f95c2dfa6..8199b51448 100644 --- a/common/cpw/mods/fml/common/registry/GameRegistry.java +++ b/common/cpw/mods/fml/common/registry/GameRegistry.java @@ -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 * 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 name The name of the stack * @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) { 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; } }