From 9a33c60d20cdd82008a242e546f0eb0aae34afb7 Mon Sep 17 00:00:00 2001 From: Candice Neill Date: Sun, 2 Aug 2015 11:58:18 -0500 Subject: [PATCH] Fixed ArrayIndexOutOfBoundsException on DiamondApple getUnlocalizedName(); compressed to max --- src/main/java/tconstruct/armor/items/DiamondApple.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/tconstruct/armor/items/DiamondApple.java b/src/main/java/tconstruct/armor/items/DiamondApple.java index 3fb21b7b234..a352196088e 100644 --- a/src/main/java/tconstruct/armor/items/DiamondApple.java +++ b/src/main/java/tconstruct/armor/items/DiamondApple.java @@ -75,14 +75,6 @@ public void registerIcons (IIconRegister iconRegister) @Override public String getUnlocalizedName (ItemStack itemstack) { - int damage = itemstack.getItemDamage(); - int name_index = damage; - - if( name_index < 0 || name_index >= itemNames.length ) - { - name_index = 0; - } - - return (new StringBuilder()).append("item.food.").append(itemNames[name_index]).toString(); + return (new StringBuilder()).append("item.food.").append(itemNames[(itemstack.getItemDamage()>=itemNames.length||itemstack.getItemDamage()<0)?(0):(itemstack.getItemDamage())]).toString(); } }