Check for valid metadata before looking up name. Closes #135
This commit is contained in:
parent
443fe18f93
commit
c9c1c30d3b
|
@ -36,7 +36,16 @@ public class ItemIronChest extends ItemBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack itemstack)
|
public String getUnlocalizedName(ItemStack itemstack)
|
||||||
|
{
|
||||||
|
int meta = itemstack.getMetadata();
|
||||||
|
|
||||||
|
if (meta < IronChestType.VALUES.length)
|
||||||
{
|
{
|
||||||
return "tile.ironchest.chest." + IronChestType.VALUES[itemstack.getMetadata()].name().toLowerCase(Locale.US);
|
return "tile.ironchest.chest." + IronChestType.VALUES[itemstack.getMetadata()].name().toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return super.getUnlocalizedName(itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,16 @@ public class ItemIronShulkerBox extends ItemBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack itemstack)
|
public String getUnlocalizedName(ItemStack itemstack)
|
||||||
|
{
|
||||||
|
int meta = itemstack.getMetadata();
|
||||||
|
|
||||||
|
if (meta < IronShulkerBoxType.VALUES.length)
|
||||||
{
|
{
|
||||||
return "tile.ironchest.shulker_box." + IronShulkerBoxType.VALUES[itemstack.getMetadata()].name().toLowerCase(Locale.US) + "." + this.colorName;
|
return "tile.ironchest.shulker_box." + IronShulkerBoxType.VALUES[itemstack.getMetadata()].name().toLowerCase(Locale.US) + "." + this.colorName;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return super.getUnlocalizedName(itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue