private static String tryGetName(Object target) {
if (target == null) return "invalid";
final Class<? extends Object> cls = target.getClass();
PeripheralTypeId customId = cls.getAnnotation(PeripheralTypeId.class);
if (customId != null) return customId.value();
if (target instanceof IInventory) {
try {
return ((IInventory)target).getInventoryName();
} catch (Throwable t) {