mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Fixed ArrayIndexOutOfBoundsException on DiamondApple getUnlocalizedName()
This commit is contained in:
1 parent
95bb4556a5
commit
7ba86b1388
1 file changed
+13
-1
@@ -75,6 +75,18 @@ public class DiamondApple extends ItemFood
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[itemstack.getItemDamage()]).toString();
|
||||
int damage = itemstack.getItemDamage();
|
||||
int name_index = 0;
|
||||
|
||||
if( damage < 0 )
|
||||
{
|
||||
name_index = 0;
|
||||
}
|
||||
else if( damage >= itemNames.length )
|
||||
{
|
||||
name_index = itemNames.length-1;
|
||||
}
|
||||
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[name_index]).toString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user