After changing the potion or monster egg display name the item will lost all its attributes (see attachment).
Code:
ItemStack pot1 = new ItemStack(Material.POTION, 1, (short) 16378); ItemStack egg1 = new ItemStack(Material.MONSTER_EGG, 1, (short) 90); ItemStack egg2 = new ItemStack(Material.MONSTER_EGG, 1, (short) 90); ItemMeta meta = egg2.getItemMeta(); meta.setDisplayName("EGG"); egg2.setItemMeta(meta); ItemStack pot2 = new ItemStack(Material.POTION, 1, (short) 16378); ItemMeta meta2 = pot2.getItemMeta(); meta2.setDisplayName("POTION"); pot2.setItemMeta(meta2); Inventory inv = Bukkit.createInventory(null, 54); inv.addItem(pot1.clone(), egg1.clone(), pot2.clone(), egg2.clone()); p.openInventory(inv); p.getInventory().addItem(pot1, egg1, pot2, egg2);